Go library that monitors real time CPU usage (total and per-core) (linux only)
$ go get github.com/simulatedsimian/cpuusage
import "github.com/simulatedsimian/cpuusage"
// display the cpu usage once per second
u := cpuusage.Usage{}
for {
err := u.Measure()
if err != nil {
// handle error....
}
fmt.Printf("Overall %%: %d Per Core %%: %v\n", u.Overall, u.Cores)
time.Sleep(1 * time.Second)
}