Documentation ¶
Index ¶
- Constants
- Variables
- func ConvertAllFilledProcesses(processes map[int32]*process.FilledProcess) map[int32]*Process
- func ConvertAllFilledProcessesToStats(processes map[int32]*process.FilledProcess) map[int32]*Stats
- func PidExists(pid int) bool
- type CPUTimesStat
- type IOCountersStat
- type MemoryInfoExStat
- type MemoryInfoStat
- type NumCtxSwitchesStat
- type Option
- type Probe
- type Process
- type Stats
- type StatsWithPerm
Constants ¶
const ( // WorldReadable represents file permission that's world readable WorldReadable os.FileMode = 4 // DefaultClockTicks is the default number of clock ticks per second // C.sysconf(C._SC_CLK_TCK) DefaultClockTicks = float64(100) )
Variables ¶
var ( // PageSize is the system's memory page size PageSize = uint64(os.Getpagesize()) )
Functions ¶
func ConvertAllFilledProcesses ¶
func ConvertAllFilledProcesses(processes map[int32]*process.FilledProcess) map[int32]*Process
ConvertAllFilledProcesses takes a group of FilledProcess objects and convert them into Process
func ConvertAllFilledProcessesToStats ¶
func ConvertAllFilledProcessesToStats(processes map[int32]*process.FilledProcess) map[int32]*Stats
ConvertAllFilledProcessesToStats takes a group of FilledProcess objects and convert them into Stats
Types ¶
type CPUTimesStat ¶
type CPUTimesStat struct { User float64 System float64 Idle float64 Nice float64 Iowait float64 Irq float64 Softirq float64 Steal float64 Guest float64 GuestNice float64 Stolen float64 Timestamp int64 }
CPUTimesStat holds CPU stat metrics of a process
func ConvertFromCPUStat ¶
func ConvertFromCPUStat(s cpu.TimesStat) *CPUTimesStat
ConvertFromCPUStat converts gopsutil TimesStat object to CPUTimesStat in procutil
func (*CPUTimesStat) Total ¶
func (c *CPUTimesStat) Total() float64
Total returns the total number of seconds in a CPUTimesStat
type IOCountersStat ¶
IOCountersStat holds IO metrics for a process
func ConvertFromIOStats ¶
func ConvertFromIOStats(s *process.IOCountersStat) *IOCountersStat
ConvertFromIOStats converts gopsutil IOCountersStat object to IOCounterStat in procutil
func (*IOCountersStat) IsZeroValue ¶
func (i *IOCountersStat) IsZeroValue() bool
IsZeroValue checks whether all fields are 0 in value for IOCountersStat
type MemoryInfoExStat ¶
type MemoryInfoExStat struct { RSS uint64 // bytes VMS uint64 // bytes Text uint64 // bytes Lib uint64 // bytes Data uint64 // bytes Dirty uint64 // bytes }
MemoryInfoExStat holds all memory metrics for a process
func ConvertFromMemInfoEx ¶
func ConvertFromMemInfoEx(s *process.MemoryInfoExStat) *MemoryInfoExStat
ConvertFromMemInfoEx converts gopsutil MemoryInfoExStat object to MemoryInfoExStat in procutil
type MemoryInfoStat ¶
MemoryInfoStat holds commonly used memory metrics for a process
func ConvertFromMemInfo ¶
func ConvertFromMemInfo(s *process.MemoryInfoStat) *MemoryInfoStat
ConvertFromMemInfo converts gopsutil MemoryInfoStat object to MemoryInfoStat in procutil
type NumCtxSwitchesStat ¶
NumCtxSwitchesStat holds context switch metrics for a process
func ConvertFromCtxSwitches ¶
func ConvertFromCtxSwitches(s *process.NumCtxSwitchesStat) *NumCtxSwitchesStat
ConvertFromCtxSwitches converts gopsutil NumCtxSwitchesStat object to NumCtxSwitchesStat in procutil
type Option ¶
type Option func(p *Probe)
Option is config options callback for system-probe
func WithPermission ¶
WithPermission configures if process collection should fetch fields that require elevated permission or not
func WithReturnZeroPermStats ¶
WithReturnZeroPermStats configures whether StatsWithPermByPID() returns StatsWithPerm that has zero values on all fields
type Probe ¶
type Probe struct {
// contains filtered or unexported fields
}
Probe is a service that fetches process related info on current host
func NewProcessProbe ¶
NewProcessProbe initializes a new Probe object
func (*Probe) ProcessesByPID ¶
ProcessesByPID returns a map of process info indexed by PID
func (*Probe) StatsForPIDs ¶
StatsForPIDs returns a map of stats info indexed by PID using the given PIDs
func (*Probe) StatsWithPermByPID ¶
func (p *Probe) StatsWithPermByPID() (map[int32]*StatsWithPerm, error)
StatsWithPermByPID returns the stats that require elevated permission to collect for each process
type Process ¶
type Process struct { Pid int32 Ppid int32 NsPid int32 // process namespaced PID Name string Cwd string Exe string Cmdline []string Username string // (Windows only) Uids []int32 Gids []int32 Stats *Stats }
Process holds all relevant metadata and metrics for a process
func ConvertFromFilledProcess ¶
func ConvertFromFilledProcess(p *process.FilledProcess) *Process
ConvertFromFilledProcess takes a FilledProcess object and convert it into Process
type Stats ¶
type Stats struct { CreateTime int64 // Status returns the process status. // Return value could be one of these. // R: Running S: Sleep T: Stop I: Idle // Z: Zombie W: Wait L: Lock // The character is the same within all supported platforms. Status string Nice int32 OpenFdCount int32 NumThreads int32 CPUTime *CPUTimesStat MemInfo *MemoryInfoStat MemInfoEx *MemoryInfoExStat IOStat *IOCountersStat CtxSwitches *NumCtxSwitchesStat }
Stats holds all relevant stats metrics of a process
func ConvertFilledProcessesToStats ¶
func ConvertFilledProcessesToStats(p *process.FilledProcess) *Stats
ConvertFilledProcessesToStats takes a group of FilledProcess objects and convert them into Stats
type StatsWithPerm ¶
type StatsWithPerm struct { OpenFdCount int32 IOStat *IOCountersStat }
StatsWithPerm is a collection of stats that require elevated permission to collect in linux