mirror of
https://github.com/octoleo/syncthing.git
synced 2025-01-03 07:12:27 +00:00
cmd/syncthing: Skip a calculation if timediff is zero (fixes #2854)
This commit is contained in:
parent
55e80c3883
commit
94c6110f2e
@ -42,6 +42,10 @@ func trackCPUUsage() {
|
|||||||
|
|
||||||
curTime := time.Now().UnixNano()
|
curTime := time.Now().UnixNano()
|
||||||
timeDiff := curTime - prevTime
|
timeDiff := curTime - prevTime
|
||||||
|
// This is sometimes 0, no clue why.
|
||||||
|
if timeDiff == 0 {
|
||||||
|
continue
|
||||||
|
}
|
||||||
curUsage := ktime.Nanoseconds() + utime.Nanoseconds()
|
curUsage := ktime.Nanoseconds() + utime.Nanoseconds()
|
||||||
usageDiff := curUsage - prevUsage
|
usageDiff := curUsage - prevUsage
|
||||||
cpuUsageLock.Lock()
|
cpuUsageLock.Lock()
|
||||||
|
Loading…
Reference in New Issue
Block a user