1
0
Fork 0

부하 줄임

This commit is contained in:
Sangbum Kim 2017-09-26 07:53:09 +09:00
parent aab5631ca7
commit 6b4fc97216
3 changed files with 8 additions and 1 deletions

View File

@ -93,7 +93,7 @@ func (m *influxMetric) StartLogging() {
case <-ticker:
sendData := make([]data, m.processorCount)
copy(sendData, metricData)
go m.sendPoint(influxDbConn, batchPoint, sendData)
m.sendPoint(influxDbConn, batchPoint, sendData)
case changedSpeed := <-m.fanSpeedConsumer:
metricData[changedSpeed.Id].FanSpeed = changedSpeed.FanSpeed
case changedTempeture := <-m.tempetureConsumer:

View File

@ -73,6 +73,8 @@ func FanoutSpeed(sender <-chan processor.FanspeedInfo, handler util.Handler, rec
log.Warn("Some Fanspeed consumer blocked!")
}
}
runtime.Gosched()
case <-handler.Done():
return
}
@ -96,6 +98,8 @@ func FanoutTempeture(sender <-chan processor.TempetureInfo, handler util.Handler
log.Warn("Some Tempeture consumer blocked!")
}
}
runtime.Gosched()
case <-handler.Done():
return
}

View File

@ -14,6 +14,7 @@ import (
"strings"
"amuz.es/src/infra/cpu_ctrl/pid"
"amuz.es/src/infra/cpu_ctrl/util"
"runtime"
)
type processor struct {
@ -150,6 +151,7 @@ func (p *processor) StartMonitoring() {
At: now,
}:
default:
runtime.Gosched()
}
}
p.tempeture = highestTemp
@ -167,6 +169,7 @@ func (p *processor) StartMonitoring() {
At: now,
}:
default:
runtime.Gosched()
}
}
p.fanSpeed = fanspeed