common

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

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

Go to latest
Published: Jun 30, 2016 License: Apache-2.0 Imports: 8 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 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 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
	CpuTicks         bool
}

func (*CPU) AddCpuPercentage

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

func (*CPU) AddCpuPercentageList

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

func (*CPU) GetCoreStats

func (cpu *CPU) GetCoreStats() ([]common.MapStr, error)

func (*CPU) GetCpuStatEvent

func (cpu *CPU) GetCpuStatEvent(cpuStat *CpuTimes) common.MapStr

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"`
	IdlePercent    float64 `json:"idle_p"`
	IOwaitPercent  float64 `json:"iowait_p"`
	IrqPercent     float64 `json:"irq_p"`
	NicePercent    float64 `json:"nice_p"`
	SoftIrqPercent float64 `json:"softirq_p"`
	StealPercent   float64 `json:"steal_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
	CpuTicks bool
	// contains filtered or unexported fields
}

func (*ProcStats) GetProcStats

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

func (*ProcStats) GetProcStatsEvents

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

func (*ProcStats) GetProcessEvent

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

func (*ProcStats) InitProcStats

func (procStats *ProcStats) InitProcStats() error

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
}

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