mirror of
https://github.com/syncthing/syncthing.git
synced 2026-01-17 18:28:47 -05:00
cmd/syncthing: Skip a calculation if timediff is zero (fixes #2854)
This commit is contained in:
committed by
Jakob Borg
parent
55e80c3883
commit
cd216ead50
@@ -42,6 +42,10 @@ func trackCPUUsage() {
|
||||
|
||||
curTime := time.Now().UnixNano()
|
||||
timeDiff := curTime - prevTime
|
||||
// This is sometimes 0, no clue why.
|
||||
if timeDiff == 0 {
|
||||
continue
|
||||
}
|
||||
curUsage := ktime.Nanoseconds() + utime.Nanoseconds()
|
||||
usageDiff := curUsage - prevUsage
|
||||
cpuUsageLock.Lock()
|
||||
|
||||
Reference in New Issue
Block a user