1
0
Fork 0

로그 추가

This commit is contained in:
Sangbum Kim 2017-09-11 00:37:01 +09:00
parent 6ab305cd31
commit dd5ab35273
2 changed files with 15 additions and 2 deletions

View File

@ -6,6 +6,12 @@ import (
"amuz.es/src/infra/cpu_ctrl/util" "amuz.es/src/infra/cpu_ctrl/util"
"time" "time"
"amuz.es/src/infra/cpu_ctrl/processor" "amuz.es/src/infra/cpu_ctrl/processor"
"amuz.es/src/infra/cpu_ctrl/logger"
"bytes"
)
var (
log = logger.NewLogger("consumer")
) )
type fanControl struct { type fanControl struct {
@ -55,7 +61,7 @@ func (c *fanControl) StartControl() {
return return
} }
} }
if (compareFanSpeed(fanSpeedList, newFanSpeedList)) { if (!compareFanSpeed(fanSpeedList, newFanSpeedList)) {
fanSpeedList = newFanSpeedList fanSpeedList = newFanSpeedList
args := make([]string, 0) args := make([]string, 0)
args = append(args, args = append(args,
@ -73,6 +79,12 @@ func (c *fanControl) StartControl() {
c.handler.NotifyError(err) c.handler.NotifyError(err)
return return
} }
buf := bytes.NewBufferString("")
for _, item := range fanSpeedList {
buf.WriteString(fmt.Sprintf("0x%x", item))
buf.WriteRune(' ')
}
log.Infof("Commit fan speed with %s", buf.String())
} }
} }
} }

View File

@ -147,6 +147,7 @@ func (p *processor) StartMonitoring() {
} }
} }
p.tempeture = highestTemp p.tempeture = highestTemp
log.Infof("processor %d : tempeture changed %f", p.id, highestTemp)
} }
fanspeed = p.normalizeFanspeed(p.fanController.Update(highestTemp)) fanspeed = p.normalizeFanspeed(p.fanController.Update(highestTemp))
@ -159,10 +160,10 @@ func (p *processor) StartMonitoring() {
}: }:
default: default:
} }
log.Infof("processor %d : fan changed 0x%x", p.id, fanspeed)
} }
p.fanSpeed = fanspeed p.fanSpeed = fanspeed
} }
case <-p.handler.Done(): case <-p.handler.Done():
return return
} }