Explorar o código

Reduce CPU usage (fixes #1376)

Jakob Borg %!s(int64=10) %!d(string=hai) anos
pai
achega
4b1b56fee8
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      cmd/syncthing/gui.go

+ 1 - 1
cmd/syncthing/gui.go

@@ -457,7 +457,7 @@ func restGetSystem(w http.ResponseWriter, r *http.Request) {
 		cpusum += p
 	}
 	cpuUsageLock.RUnlock()
-	res["cpuPercent"] = cpusum / 10
+	res["cpuPercent"] = cpusum / float64(len(cpuUsagePercent)) / float64(runtime.NumCPU())
 	res["pathSeparator"] = string(filepath.Separator)
 
 	w.Header().Set("Content-Type", "application/json; charset=utf-8")