From 4b1b56fee87dc96139882957d01632e7c0b9f7c7 Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 25 Feb 2015 23:30:24 +0100 Subject: [PATCH] Reduce CPU usage (fixes #1376) --- cmd/syncthing/gui.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/syncthing/gui.go b/cmd/syncthing/gui.go index 21020e7f..4d4c703a 100644 --- a/cmd/syncthing/gui.go +++ b/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")