mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-08 22:31:04 +00:00
cmd/syncthing: Skip a calculation if timediff is zero (fixes #2854)
This commit is contained in:
parent
1934b3a5b6
commit
b678b4e048
@ -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