/usr/share/gocode/src/github.com/cloudfoundry/gosigar/examples/free.go is in golang-github-cloudfoundry-gosigar-dev 0.0~git20150402.27.3ed7c74-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | // Copyright (c) 2012 VMware, Inc.
package main
import (
"fmt"
"github.com/cloudfoundry/gosigar"
"os"
)
func format(val uint64) uint64 {
return val / 1024
}
func main() {
mem := sigar.Mem{}
swap := sigar.Swap{}
mem.Get()
swap.Get()
fmt.Fprintf(os.Stdout, "%18s %10s %10s\n",
"total", "used", "free")
fmt.Fprintf(os.Stdout, "Mem: %10d %10d %10d\n",
format(mem.Total), format(mem.Used), format(mem.Free))
fmt.Fprintf(os.Stdout, "-/+ buffers/cache: %10d %10d\n",
format(mem.ActualUsed), format(mem.ActualFree))
fmt.Fprintf(os.Stdout, "Swap: %10d %10d %10d\n",
format(swap.Total), format(swap.Used), format(swap.Free))
}
|