mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 11:28:59 +00:00
cmd/syncthing: Report correct CPU usage on Windows (fixes #4133)
This commit is contained in:
parent
d6fbfc3545
commit
43569d8d36
@ -857,7 +857,10 @@ func init() {
|
||||
return
|
||||
}
|
||||
go func() {
|
||||
var prevUsage time.Duration
|
||||
// Initialize prevUsage to an actual value returned by cpuUsage
|
||||
// instead of zero, because at least Windows returns a huge negative
|
||||
// number here that then slowly increments...
|
||||
prevUsage := cpuUsage()
|
||||
for range time.NewTicker(cpuTickRate).C {
|
||||
curUsage := cpuUsage()
|
||||
cpuAverage.Update(int64((curUsage - prevUsage) / time.Millisecond))
|
||||
|
Loading…
Reference in New Issue
Block a user