Documentation
¶
Index ¶
- Constants
- Variables
- func FormatPercent(percent float64) string
- func FormatSize(size uint64) string
- func IsNotImplemented(err error) bool
- type ConcreteSigar
- func (c *ConcreteSigar) CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
- func (c *ConcreteSigar) GetFDUsage() (FDUsage, error)
- func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error)
- func (c *ConcreteSigar) GetHugeTLBPages() (HugeTLBPages, error)
- func (c *ConcreteSigar) GetLoadAverage() (LoadAverage, error)
- func (c *ConcreteSigar) GetMem() (Mem, error)
- func (c *ConcreteSigar) GetRusage(who int) (Rusage, error)
- func (c *ConcreteSigar) GetSwap() (Swap, error)
- type Cpu
- type CpuList
- type ErrNotImplemented
- type FDUsage
- type FileSystem
- type FileSystemList
- type FileSystemUsage
- type HugeTLBPages
- type LoadAverage
- type Mem
- type ProcArgs
- type ProcEnv
- type ProcExe
- type ProcFDUsage
- type ProcList
- type ProcMem
- type ProcState
- type ProcTime
- type RunState
- type Rusage
- type Sigar
- type Swap
- type Uptime
Constants ¶
const ( // RunStateSleep corresponds to a sleep state RunStateSleep = 'S' // RunStateRun corresponds to a running state RunStateRun = 'R' // RunStateStop corresponds to a stopped state RunStateStop = 'T' // RunStateZombie marks a zombie process RunStateZombie = 'Z' // RunStateIdle corresponds to an idle state RunStateIdle = 'D' // RunStateUnknown corresponds to a process in an unknown state RunStateUnknown = '?' )
Variables ¶
var Procd string
Functions ¶
func FormatPercent ¶
func IsNotImplemented ¶
IsNotImplemented returns true if the error is ErrNotImplemented
Types ¶
type ConcreteSigar ¶
type ConcreteSigar struct{}
func (*ConcreteSigar) CollectCpuStats ¶
func (c *ConcreteSigar) CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
func (*ConcreteSigar) GetFDUsage ¶
func (c *ConcreteSigar) GetFDUsage() (FDUsage, error)
func (*ConcreteSigar) GetFileSystemUsage ¶
func (c *ConcreteSigar) GetFileSystemUsage(path string) (FileSystemUsage, error)
func (*ConcreteSigar) GetHugeTLBPages ¶ added in v0.9.0
func (c *ConcreteSigar) GetHugeTLBPages() (HugeTLBPages, error)
func (*ConcreteSigar) GetLoadAverage ¶
func (c *ConcreteSigar) GetLoadAverage() (LoadAverage, error)
func (*ConcreteSigar) GetMem ¶
func (c *ConcreteSigar) GetMem() (Mem, error)
func (*ConcreteSigar) GetRusage ¶ added in v0.8.0
func (c *ConcreteSigar) GetRusage(who int) (Rusage, error)
GetRusage return the resource usage of the process Possible params: 0 = RUSAGE_SELF, 1 = RUSAGE_CHILDREN, 2 = RUSAGE_THREAD
func (*ConcreteSigar) GetSwap ¶
func (c *ConcreteSigar) GetSwap() (Swap, error)
type Cpu ¶
type Cpu struct {
User uint64
Nice uint64
Sys uint64
Idle uint64
Wait uint64
Irq uint64
SoftIrq uint64
Stolen uint64
}
Cpu contains CPU time stats
type CpuList ¶
type CpuList struct {
List []Cpu
}
CpuList contains a list of CPUs on the host system
type ErrNotImplemented ¶
type ErrNotImplemented struct {
OS string
}
ErrNotImplemented is returned when a particular statistic isn't implemented on the host OS.
func (ErrNotImplemented) Error ¶
func (e ErrNotImplemented) Error() string
type FileSystem ¶
type FileSystem struct {
DirName string
DevName string
TypeName string
SysTypeName string
Options string
Flags uint32
}
FileSystem contains basic information about a given mounted filesystem
type FileSystemList ¶
type FileSystemList struct {
List []FileSystem
}
FileSystemList gets a list of mounted filesystems
func (*FileSystemList) Get ¶
func (self *FileSystemList) Get() error
type FileSystemUsage ¶
type FileSystemUsage struct {
Total uint64
Used uint64
Free uint64
Avail uint64
Files uint64
FreeFiles uint64
}
FileSystemUsage contains basic stats for the specified filesystem
func (*FileSystemUsage) Get ¶
func (self *FileSystemUsage) Get(path string) error
func (*FileSystemUsage) UsePercent ¶
func (self *FileSystemUsage) UsePercent() float64
type HugeTLBPages ¶ added in v0.9.0
type HugeTLBPages struct {
Total uint64
Free uint64
Reserved uint64
Surplus uint64
DefaultSize uint64
TotalAllocatedSize uint64
}
HugeTLBPages contains HugePages stats
func (*HugeTLBPages) Get ¶ added in v0.9.0
func (self *HugeTLBPages) Get() error
Get returns hugepages data
type LoadAverage ¶
type LoadAverage struct {
One, Five, Fifteen float64
}
LoadAverage reports standard load averages
func (*LoadAverage) Get ¶
func (self *LoadAverage) Get() error
type Mem ¶
type Mem struct {
Total uint64
Used uint64
Free uint64
Cached uint64
ActualFree uint64
ActualUsed uint64
}
Mem contains host memory stats
type ProcArgs ¶
type ProcArgs struct {
List []string
}
ProcArgs contains a list of args for a specified process
type ProcFDUsage ¶
ProcFDUsage contains data on file limits and usage
type ProcList ¶
type ProcList struct {
List []int
}
ProcList contains a list of processes found on the host system
type ProcMem ¶
type ProcMem struct {
Size uint64
Resident uint64
MinorFaults uint64
MajorFaults uint64
PageFaults uint64
}
ProcMem contains memory statistics for a specified process
type ProcState ¶
type ProcState struct {
Name string
Username string
State RunState
Ppid int
Pgid int
Tty int
Priority int
Nice int
Processor int
}
ProcState contains basic metadata and process ownership info for the specified process
type ProcTime ¶
ProcTime contains run time statistics for a specified process
func (*ProcTime) FormatStartTime ¶
func (*ProcTime) FormatTotal ¶
type RunState ¶
type RunState byte
RunState is a byte-long code used to specify the current runtime state of a process
type Rusage ¶ added in v0.8.0
type Rusage struct {
Utime time.Duration
Stime time.Duration
Maxrss int64
Ixrss int64
Idrss int64
Isrss int64
Minflt int64
Majflt int64
Nswap int64
Inblock int64
Oublock int64
Msgsnd int64
Msgrcv int64
Nsignals int64
Nvcsw int64
Nivcsw int64
}
Rusage contains data on resource usage for a specified process
type Sigar ¶
type Sigar interface {
CollectCpuStats(collectionInterval time.Duration) (<-chan Cpu, chan<- struct{})
GetLoadAverage() (LoadAverage, error)
GetMem() (Mem, error)
GetSwap() (Swap, error)
GetHugeTLBPages(HugeTLBPages, error)
GetFileSystemUsage(string) (FileSystemUsage, error)
GetFDUsage() (FDUsage, error)
GetRusage(who int) (Rusage, error)
}
Sigar is an interface for gathering system host stats
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package cgroup reads metrics and other tunable parameters associated with control groups, a Linux kernel feature for grouping tasks to track and limit resource usage.
|
Package cgroup reads metrics and other tunable parameters associated with control groups, a Linux kernel feature for grouping tasks to track and limit resource usage. |
|
examples
|
|
|
df
command
|
|
|
free
command
|
|
|
ps
command
|
|
|
ss
command
|
|
|
uptime
command
|
|
|
Go interface to the Linux netlink process connector.
|
Go interface to the Linux netlink process connector. |
|
windows
Package windows contains various Windows system call.
|
Package windows contains various Windows system call. |