부하 줄임
This commit is contained in:
parent
aab5631ca7
commit
6b4fc97216
|
@ -93,7 +93,7 @@ func (m *influxMetric) StartLogging() {
|
||||||
case <-ticker:
|
case <-ticker:
|
||||||
sendData := make([]data, m.processorCount)
|
sendData := make([]data, m.processorCount)
|
||||||
copy(sendData, metricData)
|
copy(sendData, metricData)
|
||||||
go m.sendPoint(influxDbConn, batchPoint, sendData)
|
m.sendPoint(influxDbConn, batchPoint, sendData)
|
||||||
case changedSpeed := <-m.fanSpeedConsumer:
|
case changedSpeed := <-m.fanSpeedConsumer:
|
||||||
metricData[changedSpeed.Id].FanSpeed = changedSpeed.FanSpeed
|
metricData[changedSpeed.Id].FanSpeed = changedSpeed.FanSpeed
|
||||||
case changedTempeture := <-m.tempetureConsumer:
|
case changedTempeture := <-m.tempetureConsumer:
|
||||||
|
|
4
main.go
4
main.go
|
@ -73,6 +73,8 @@ func FanoutSpeed(sender <-chan processor.FanspeedInfo, handler util.Handler, rec
|
||||||
log.Warn("Some Fanspeed consumer blocked!")
|
log.Warn("Some Fanspeed consumer blocked!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
runtime.Gosched()
|
||||||
|
|
||||||
case <-handler.Done():
|
case <-handler.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -96,6 +98,8 @@ func FanoutTempeture(sender <-chan processor.TempetureInfo, handler util.Handler
|
||||||
log.Warn("Some Tempeture consumer blocked!")
|
log.Warn("Some Tempeture consumer blocked!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
runtime.Gosched()
|
||||||
|
|
||||||
case <-handler.Done():
|
case <-handler.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"amuz.es/src/infra/cpu_ctrl/pid"
|
"amuz.es/src/infra/cpu_ctrl/pid"
|
||||||
"amuz.es/src/infra/cpu_ctrl/util"
|
"amuz.es/src/infra/cpu_ctrl/util"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type processor struct {
|
type processor struct {
|
||||||
|
@ -150,6 +151,7 @@ func (p *processor) StartMonitoring() {
|
||||||
At: now,
|
At: now,
|
||||||
}:
|
}:
|
||||||
default:
|
default:
|
||||||
|
runtime.Gosched()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.tempeture = highestTemp
|
p.tempeture = highestTemp
|
||||||
|
@ -167,6 +169,7 @@ func (p *processor) StartMonitoring() {
|
||||||
At: now,
|
At: now,
|
||||||
}:
|
}:
|
||||||
default:
|
default:
|
||||||
|
runtime.Gosched()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
p.fanSpeed = fanspeed
|
p.fanSpeed = fanspeed
|
||||||
|
|
Loading…
Reference in New Issue