diff --git a/consumer/speed_controller.go b/consumer/speed_controller.go index 6cbc7f8..a7d3ee8 100644 --- a/consumer/speed_controller.go +++ b/consumer/speed_controller.go @@ -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()) } } } diff --git a/processor/processor.go b/processor/processor.go index 98bf38c..92c6a37 100644 --- a/processor/processor.go +++ b/processor/processor.go @@ -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 }