0xcafed00d / cpuusage

Go library that monitors real time CPU usage (total and per-core) (linux only)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cpuusage GoDoc

Go library that monitors real time CPU usage (total and per-core) (linux only)

Installation:

$ go get github.com/simulatedsimian/cpuusage

Example:

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)
}

About

Go library that monitors real time CPU usage (total and per-core) (linux only)

License:MIT License


Languages

Language:Go 100.0%