Documentation ¶
Index ¶
- Variables
- func GetOwnResourceUsageTimeInMillis() (int64, int64, error)
- func GetProcCPUPercentage(s0, s1 *Process) (normalizedPct, pct, totalPct float64)
- func GetProcMemPercentage(proc *Process, totalPhyMem uint64) float64
- func Pids() ([]int, error)
- type IncludeTopConfig
- type Process
- type ProcsMap
- type Stats
- type Ticks
Constants ¶
This section is empty.
Variables ¶
var NumCPU = runtime.NumCPU()
NumCPU is the number of CPUs of the host
Functions ¶
func GetOwnResourceUsageTimeInMillis ¶
GetOwnResourceUsageTimeInMillis return the user and system CPU usage time in milliseconds
func GetProcCPUPercentage ¶
GetProcCPUPercentage returns the percentage of total CPU time consumed by the process during the period between the given samples. Two percentages are returned (these must be multiplied by 100). The first is a normalized based on the number of cores such that the value ranges on [0, 1]. The second is not normalized and the value ranges on [0, number_of_cores].
Implementation note: The total system CPU time (including idle) is not provided so this method will resort to using the difference in wall-clock time multiplied by the number of cores as the total amount of CPU time available between samples. This could result in incorrect percentages if the wall-clock is adjusted (prior to Go 1.9) or the machine is suspended.
func GetProcMemPercentage ¶
Types ¶
type IncludeTopConfig ¶
type IncludeTopConfig struct { Enabled bool `config:"enabled"` ByCPU int `config:"by_cpu"` ByMemory int `config:"by_memory"` }
IncludeTopConfig is the configuration for the "top N processes filtering" feature
type Process ¶
type Process struct { Pid int `json:"pid"` Ppid int `json:"ppid"` Pgid int `json:"pgid"` Name string `json:"name"` Username string `json:"username"` State string `json:"state"` CmdLine string `json:"cmdline"` Cwd string `json:"cwd"` Mem sigar.ProcMem Cpu sigar.ProcTime SampleTime time.Time FD sigar.ProcFDUsage Env common.MapStr // contains filtered or unexported fields }
Process is the structure which holds the information of a process running on the host. It includes pid, gid and it interacts with gosigar to fetch process data from the host.
type ProcsMap ¶
ProcsMap is a map where the keys are the names of processes and the value is the Process with that name
type Stats ¶
type Stats struct { Procs []string ProcsMap ProcsMap CpuTicks bool EnvWhitelist []string CacheCmdLine bool IncludeTop IncludeTopConfig // contains filtered or unexported fields }
Stats stores the stats of preocesses on the host.