system

package
v5.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2016 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFileSystemUsedPercentage

func AddFileSystemUsedPercentage(f *FileSystemStat)

func AddMemPercentage

func AddMemPercentage(m *MemStat)

func AddSwapPercentage

func AddSwapPercentage(s *SwapStat)

func CollectFileSystemStats

func CollectFileSystemStats(fss []sigar.FileSystem) []common.MapStr

func GetCpuStatEvent

func GetCpuStatEvent(cpuStat *CpuTimes) common.MapStr

func GetFileSystemList

func GetFileSystemList() ([]sigar.FileSystem, error)

func GetFileSystemStats

func GetFileSystemStats() ([]common.MapStr, error)

func GetFilesystemEvent

func GetFilesystemEvent(fsStat *FileSystemStat) common.MapStr

func GetMemoryEvent

func GetMemoryEvent(memStat *MemStat) common.MapStr

func GetProcCpuPercentage

func GetProcCpuPercentage(last *Process, current *Process) float64

func GetProcMemPercentage

func GetProcMemPercentage(proc *Process, total_phymem uint64) float64

func GetProcessEvent

func GetProcessEvent(process *Process, last *Process) common.MapStr

func GetSwapEvent

func GetSwapEvent(swapStat *SwapStat) common.MapStr

func Pids

func Pids() ([]int, error)

func Round

func Round(val float64, roundOn float64, places int) (newVal float64)

Types

type CPU

type CPU struct {
	CpuPerCore bool

	LastCpuTimes     *CpuTimes
	LastCpuTimesList []CpuTimes
}

func (*CPU) AddCpuPercentage

func (cpu *CPU) AddCpuPercentage(t2 *CpuTimes)

func (*CPU) AddCpuPercentageList

func (cpu *CPU) AddCpuPercentageList(t2 []CpuTimes)

func (*CPU) GetSystemStats

func (cpu *CPU) GetSystemStats() (common.MapStr, error)

type CpuTimes

type CpuTimes struct {
	sigar.Cpu
	UserPercent   float64 `json:"user_p"`
	SystemPercent float64 `json:"system_p"`
}

func GetCpuPercentage

func GetCpuPercentage(last *CpuTimes, current *CpuTimes) *CpuTimes

func GetCpuPercentageList

func GetCpuPercentageList(last, current []CpuTimes) []CpuTimes

func GetCpuTimes

func GetCpuTimes() (*CpuTimes, error)

func GetCpuTimesList

func GetCpuTimesList() ([]CpuTimes, error)

type FileSystemStat

type FileSystemStat struct {
	sigar.FileSystemUsage
	DevName     string  `json:"device_name"`
	Mount       string  `json:"mount_point"`
	UsedPercent float64 `json:"used_p"`
	// contains filtered or unexported fields
}

func GetFileSystemStat

func GetFileSystemStat(fs sigar.FileSystem) (*FileSystemStat, error)

type MemStat

type MemStat struct {
	sigar.Mem
	UsedPercent       float64 `json:"used_p"`
	ActualUsedPercent float64 `json:"actual_used_p"`
}

func GetMemory

func GetMemory() (*MemStat, error)

type ProcStats

type ProcStats struct {
	ProcStats bool
	Procs     []string
	ProcsMap  ProcsMap
}

func (*ProcStats) GetProcStats

func (procStats *ProcStats) GetProcStats() ([]common.MapStr, error)

func (*ProcStats) InitProcStats

func (procStats *ProcStats) InitProcStats()

func (*ProcStats) MatchProcess

func (procStats *ProcStats) MatchProcess(name string) bool

type Process

type Process struct {
	Pid      int    `json:"pid"`
	Ppid     int    `json:"ppid"`
	Name     string `json:"name"`
	Username string `json:"username"`
	State    string `json:"state"`
	CmdLine  string `json:"cmdline"`
	Mem      sigar.ProcMem
	Cpu      sigar.ProcTime
	Ctime    time.Time
}

func GetProcess

func GetProcess(pid int, cmdline string) (*Process, error)

type ProcsMap

type ProcsMap map[int]*Process

type SwapStat

type SwapStat struct {
	sigar.Swap
	UsedPercent float64 `json:"used_p"`
}

func GetSwap

func GetSwap() (*SwapStat, error)

type SystemLoad

type SystemLoad struct {
	Load1  float64 `json:"load1"`
	Load5  float64 `json:"load5"`
	Load15 float64 `json:"load15"`
}

func GetSystemLoad

func GetSystemLoad() (*SystemLoad, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL