Version: v0.0.0-...-1606168 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2015 License: BSD-2-Clause Imports: 8 Imported by: 2




This section is empty.


This section is empty.


This section is empty.


type CpuStat

type CpuStat []uint64

func (CpuStat) Guest

func (c CpuStat) Guest() uint64

Guest returns time spent running a virtual CPU for guest operating systems under the control of the Linux kernel.

func (CpuStat) GuestNice

func (c CpuStat) GuestNice() uint64

GuestNice returns time spent running a niced guest (virtual CPU for guest operating systems under the control of the Linux kernel).

func (CpuStat) GuestNiceSupported

func (c CpuStat) GuestNiceSupported() bool

GuestNiceSupported returns true if the Guest() statistic is present.

func (CpuStat) GuestSupported

func (c CpuStat) GuestSupported() bool

GuestSupported returns true if the Guest() statistic is present.

func (CpuStat) Idle

func (c CpuStat) Idle() uint64

Idle returns time spent in idle task.

func (CpuStat) Iowait

func (c CpuStat) Iowait() uint64

Iowait returns time spent waiting for I/O to complete.

func (CpuStat) Irq

func (c CpuStat) Irq() uint64

Irq returns time spent servicing all interrupts since boot.

func (CpuStat) Nice

func (c CpuStat) Nice() uint64

Nice returns spent in user mode with low priority (nice).

func (CpuStat) Softirq

func (c CpuStat) Softirq() uint64

Softirq returns time spent serviced all soft interrupts since boot.

func (CpuStat) Steal

func (c CpuStat) Steal() uint64

Steal returns stolen time, which is the time spent in other operating systems when running in a virtualized environment

func (CpuStat) StealSupported

func (c CpuStat) StealSupported() bool

StealSupported returns true if the Steal() statistic is present.

func (CpuStat) System

func (c CpuStat) System() uint64

System returns time spent in system mode.

func (CpuStat) User

func (c CpuStat) User() uint64

User returns time spent in user mode.

type Cpuinfo

type Cpuinfo struct {
	Processor      uint
	VendorId       string
	CpuFamily      uint
	Model          uint
	ModelName      string
	Stepping       uint
	Microcode      string
	CpuMHz         float32
	CacheSize      uint64
	PhysicalId     uint
	Siblings       uint
	CoreId         uint
	CpuCores       uint
	Apicid         uint
	InitialApicid  uint
	Fpu            bool
	FpuException   bool
	CpuidLevel     uint
	Wp             bool
	Flags          map[string]bool
	Bogomips       float32
	ClflushSize    uint
	CacheAlignment uint
	AddressSizes   struct {
		BitsPhysical uint8
		BitsVirtual  uint8
	PowerManagement string

func ReadCpuinfo

func ReadCpuinfo() (cpuinfos []Cpuinfo, err error)

type DiskStatsProxy

type DiskStatsProxy struct {
	Disk  string
	Major uint8
	Minor uint8
	Stats *Diskstat

DiskStatProxy is a container for a disk statistic snapshot

func ReadDiskstat

func ReadDiskstat() ([]*DiskStatsProxy, error)

ReadDiskStat does the actual collection of disk statistics

type Diskstat

type Diskstat struct {
	NReads          uint64
	NReadsMerged    uint64
	NSectorsRead    uint64
	NMsReading      uint64
	NWrites         uint64
	NWritesMerged   uint64
	NSectorsWritten uint64
	NMsWriting      uint64
	NIoInProgress   uint64
	NMsIo           uint64
	NMsIoWeighted   uint64

* Diskstat represents a snapshot of stats for a single disk * * Disk stats representation built from: * Some of these statistics are cumulative and can roll over, while others do not. This code * simply collects raw values. Refer to the link above for full docs.

type Loadavg

type Loadavg struct {
	Avg1m            float32
	Avg5m            float32
	Avg10m           float32
	RunningProcesses uint
	TotalProcesses   uint
	LastPID          uint

func ReadLoadavg

func ReadLoadavg() (stat Loadavg, err error)

type Meminfo

type Meminfo struct {
	MemTotal          uint64
	MemFree           uint64
	MemAvailable      uint64
	Buffers           uint64
	Cached            uint64
	SwapCached        uint64
	Active            uint64
	Inactive          uint64
	ActiveAnon        uint64
	InactiveAnon      uint64
	ActiveFile        uint64
	InactiveFile      uint64
	Unevictable       uint64
	Mlocked           uint64
	SwapTotal         uint64
	SwapFree          uint64
	Dirty             uint64
	Writeback         uint64
	AnonPages         uint64
	Mapped            uint64
	Shmem             uint64
	Slab              uint64
	SReclaimable      uint64
	SUnreclaim        uint64
	KernelStack       uint64
	PageTables        uint64
	NFS_Unstable      uint64
	Bounce            uint64
	WritebackTmp      uint64
	CommitLimit       uint64
	Committed_AS      uint64
	VmallocTotal      uint64
	VmallocUsed       uint64
	VmallocChunk      uint64
	HardwareCorrupted uint64
	AnonHugePages     uint64
	HugePages_Total   uint64
	HugePages_Free    uint64
	HugePages_Rsvd    uint64
	HugePages_Surp    uint64
	Hugepagesize      uint64
	DirectMap4k       uint64
	DirectMap2M       uint64
	DirectMap1G       uint64

func ReadMeminfo

func ReadMeminfo() (meminfo Meminfo, err error)

type Stat

type Stat struct {
	Cpu          CpuStat   // Cpu stat averaged across all cpus.
	CpuX         []CpuStat // Cpu stats for cpus. The CpuX[0] contains cpu0 stats.
	Intr         uint64    // Total number of interrupts since boot.
	IntrX        []uint64  // Total number of interrupts for each interrupt. IntrX[0] contains interrupts for intr0.
	Ctxt         uint64    // Number of context switches since boot.
	Btime        uint64    // Boot time, in seconds since Epoch.
	Processes    uint64    // Number of forks since boot.
	ProcsRunning uint64    // Number of processes in the running state (Linnux >= 2.5.45).
	ProcsBlocked uint64    // Number of processes blocked waiting on I/O to complete (Linux >= 2.5.45)

Stat represents data parsed from a Linux host's /proc/stat file.

func ReadStat

func ReadStat() (stat Stat, err error)

type Uptime

type Uptime struct {
	Seconds     float32 // Seconds since boot
	IdleSeconds float32 // Seconds machine has been idle since boot

func ReadUptime

func ReadUptime() (uptime Uptime, err error)

type Vmstat

type Vmstat struct {
	NrFreePages                uint
	NrInactiveAnon             uint
	NrActiveAnon               uint
	NrInactiveFile             uint
	NrActiveFile               uint
	NrUnevictable              uint
	NrMlock                    uint
	NrAnonPages                uint
	NrMapped                   uint
	NrFilePages                uint
	NrDirty                    uint
	NrWriteback                uint
	NrSlabReclaimable          uint
	NrSlabUnreclaimable        uint
	NrPageTablePages           uint
	NrKernelStack              uint
	NrUnstable                 uint
	NrBounce                   uint
	NrVmscanWrite              uint
	NrVmscanImmediateReclaim   uint
	NrWritebackTemp            uint
	NrIsolatedAnon             uint
	NrIsolatedFile             uint
	NrShmem                    uint
	NrDirtied                  uint
	NrWritten                  uint
	NumaHit                    uint
	NumaMiss                   uint
	NumaForeign                uint
	NumaInterleave             uint
	NumaLocal                  uint
	NumaOther                  uint
	NrAnonTransparentHugepages uint
	NrFreeCma                  uint
	NrDirtyThreshold           uint
	NrDirtyBackgroundThreshold uint
	Pgpgin                     uint
	Pgpgout                    uint
	Pswpin                     uint
	Pswpout                    uint
	PgallocDma                 uint
	PgallocDma32               uint
	PgallocNormal              uint
	PgallocMovable             uint
	Pgfree                     uint
	Pgactivate                 uint
	Pgdeactivate               uint
	Pgfault                    uint
	Pgmajfault                 uint
	PgrefillDma                uint
	PgrefillDma32              uint
	PgrefillNormal             uint
	PgrefillMovable            uint
	PgstealKswapdDma           uint
	PgstealKswapdDma32         uint
	PgstealKswapdNormal        uint
	PgstealKswapdMovable       uint
	PgstealDirectDma           uint
	PgstealDirectDma32         uint
	PgstealDirectNormal        uint
	PgstealDirectMovable       uint
	PgscanKswapdDma            uint
	PgscanKswapdDma32          uint
	PgscanKswapdNormal         uint
	PgscanKswapdMovable        uint
	PgscanDirectDma            uint
	PgscanDirectDma32          uint
	PgscanDirectNormal         uint
	PgscanDirectMovable        uint
	PgscanDirectThrottle       uint
	ZoneReclaimFailed          uint
	Pginodesteal               uint
	SlabsScanned               uint
	KswapdInodesteal           uint
	KswapdLowWmarkHitQuickly   uint
	KswapdHighWmarkHitQuickly  uint
	KswapdSkipCongestionWait   uint
	Pageoutrun                 uint
	Allocstall                 uint
	Pgrotated                  uint
	NumaPteUpdates             uint
	NumaHintFaults             uint
	NumaHintFaultsLocal        uint
	NumaPagesMigrated          uint
	PgmigrateSuccess           uint
	PgmigrateFail              uint
	CompactMigrateScanned      uint
	CompactFreeScanned         uint
	CompactIsolated            uint
	CompactStall               uint
	CompactFail                uint
	CompactSuccess             uint
	HtlbBuddyAllocSuccess      uint
	HtlbBuddyAllocFail         uint
	UnevictablePgsCulled       uint
	UnevictablePgsScanned      uint
	UnevictablePgsRescued      uint
	UnevictablePgsMlocked      uint
	UnevictablePgsMunlocked    uint
	UnevictablePgsCleared      uint
	UnevictablePgsStranded     uint
	ThpFaultAlloc              uint
	ThpFaultFallback           uint
	ThpCollapseAlloc           uint
	ThpCollapseAllocFailed     uint
	ThpSplit                   uint
	ThpZeroPageAlloc           uint
	ThpZeroPageAllocFailed     uint

func ReadVmstat

func ReadVmstat() (vmstat Vmstat, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL