Merge remote-tracking branch 'syncthing/pr/1577'

* syncthing/pr/1577:
  Add uptime in webgui (fixes #1501)

Conflicts:
	cmd/syncthing/gui.go
	internal/auto/gui.files.go
This commit is contained in:
Jakob Borg
2015-04-06 20:53:32 +02:00
7 changed files with 51 additions and 6 deletions

View File

@@ -47,6 +47,7 @@ var (
configInSync = true
guiErrors = []guiError{}
guiErrorsMut sync.Mutex
startTime = time.Now()
eventSub *events.BufferedSubscription
)
@@ -519,6 +520,7 @@ func restGetSystem(w http.ResponseWriter, r *http.Request) {
cpuUsageLock.RUnlock()
res["cpuPercent"] = cpusum / float64(len(cpuUsagePercent)) / float64(runtime.NumCPU())
res["pathSeparator"] = string(filepath.Separator)
res["uptime"] = int(time.Since(startTime).Seconds())
w.Header().Set("Content-Type", "application/json; charset=utf-8")
json.NewEncoder(w).Encode(res)