Debian Codegraph @

examples/uptime.go

raw symbols SCIP
1 package main
2
3 import (
4 "fmt"
5 "os"
6 "time"
7
8 "github.com/cloudfoundry/gosigar"
9 )
10
11 func main() {
12 concreteSigar := sigar.ConcreteSigar{}
13
14 uptime := sigar.Uptime{}
15 uptime.Get()
16 avg, err := concreteSigar.GetLoadAverage()
17 if err != nil {
18 fmt.Printf("Failed to get load average")
19 return
20 }
21
22 fmt.Fprintf(os.Stdout, " %s up %s load average: %.2f, %.2f, %.2f\n",
23 time.Now().Format("15:04:05"),
24 uptime.Format(),
25 avg.One, avg.Five, avg.Fifteen)
26 }