로그 추가
This commit is contained in:
parent
6ab305cd31
commit
dd5ab35273
|
@ -6,6 +6,12 @@ import (
|
|||
"amuz.es/src/infra/cpu_ctrl/util"
|
||||
"time"
|
||||
"amuz.es/src/infra/cpu_ctrl/processor"
|
||||
"amuz.es/src/infra/cpu_ctrl/logger"
|
||||
"bytes"
|
||||
)
|
||||
|
||||
var (
|
||||
log = logger.NewLogger("consumer")
|
||||
)
|
||||
|
||||
type fanControl struct {
|
||||
|
@ -55,7 +61,7 @@ func (c *fanControl) StartControl() {
|
|||
return
|
||||
}
|
||||
}
|
||||
if (compareFanSpeed(fanSpeedList, newFanSpeedList)) {
|
||||
if (!compareFanSpeed(fanSpeedList, newFanSpeedList)) {
|
||||
fanSpeedList = newFanSpeedList
|
||||
args := make([]string, 0)
|
||||
args = append(args,
|
||||
|
@ -73,6 +79,12 @@ func (c *fanControl) StartControl() {
|
|||
c.handler.NotifyError(err)
|
||||
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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -147,6 +147,7 @@ func (p *processor) StartMonitoring() {
|
|||
}
|
||||
}
|
||||
p.tempeture = highestTemp
|
||||
log.Infof("processor %d : tempeture changed %f", p.id, highestTemp)
|
||||
}
|
||||
|
||||
fanspeed = p.normalizeFanspeed(p.fanController.Update(highestTemp))
|
||||
|
@ -159,10 +160,10 @@ func (p *processor) StartMonitoring() {
|
|||
}:
|
||||
default:
|
||||
}
|
||||
log.Infof("processor %d : fan changed 0x%x", p.id, fanspeed)
|
||||
}
|
||||
p.fanSpeed = fanspeed
|
||||
}
|
||||
|
||||
case <-p.handler.Done():
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue