41

GitHub - c9s/goprocinfo: Linux /proc info parser for Go

 5 years ago
source link: https://github.com/c9s/goprocinfo
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md

goprocinfo

/proc information parser for Go.

Usage

import (
	"log"

	linuxproc "github.com/c9s/goprocinfo/linux"
)

stat, err := linuxproc.ReadStat("/proc/stat")
if err != nil {
	log.Fatal("stat read fail")
}

for _, s := range stat.CPUStats {
	// s.User
	// s.Nice
	// s.System
	// s.Idle
	// s.IOWait
}

// stat.CPUStatAll
// stat.CPUStats
// stat.Processes
// stat.BootTime
// ... etc

Documentation

Full documentation is available at Godoc.

Reference

License

goprocinfo is distributed under the MIT license.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK