Documentation
¶
Overview ¶
A wrapper around the linux syscall sysinfo(2).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SI ¶
type SI struct {
Uptime time.Duration // time since boot
Loads [3]float64 // 1, 5, and 15 minute load averages, see e.g. UPTIME(1)
Procs uint64 // number of current processes
TotalRam uint64 // total usable main memory size [kB]
FreeRam uint64 // available memory size [kB]
BufferRam uint64 // memory used by buffers [kB]
TotalSwap uint64 // total swap space size [kB]
FreeSwap uint64 // swap space still available [kB]
TotalHighRam uint64 // total high memory size [kB]
FreeHighRam uint64 // available high memory size [kB]
// contains filtered or unexported fields
}
Go-ized http://man7.org/linux/man-pages/man2/sysinfo.2.html
func Get ¶
func Get() *SI
Get the linux sysinfo data structure.
Useful links in the wild web: http://man7.org/linux/man-pages/man2/sysinfo.2.html http://man7.org/linux/man-pages/man1/uptime.1.html https://github.com/capnm/golang/blob/go1.1.1/src/pkg/syscall/zsyscall_linux_amd64.go#L1050 https://github.com/capnm/golang/blob/go1.1.1/src/pkg/syscall/ztypes_linux_amd64.go#L528 https://github.com/capnm/golang/blob/go1.1.1/src/pkg/syscall/ztypes_linux_arm.go#L502
Example ¶
si := Get()
fmt.Printf("%v\n", si.Loads)
fmt.Println(si.ToString())
Click to show internal directories.
Click to hide internal directories.