Documentation
¶
Index ¶
Constants ¶
const ( // SizeOfUint is the size of an unsigned integer - either 32 or 64. SizeOfUint uint = 32 << (^uint(0) >> 63) )
Variables ¶
This section is empty.
Functions ¶
func GetProcIDs ¶
func GetProcIDs() (ret []int)
GetProcIDs returns a list of all process IDs visible to this program according to the information available from procfs.
func GetProcTaskIDs ¶
GetProcTaskIDs returns a sorted list of task (thread) IDs that belong to the process identified by ID. As a special case, if the input process ID is 0, then the return value will belong to the process invoking this function.
Types ¶
type ProcessAndTasks ¶
type ProcessAndTasks struct { Status ProcessStatus Stats ProcessStats Tasks map[int]TaskStatus SchedulerStatsSum SchedulerStats }
ProcessAndTasks describes the identity and resource usage of a process and its tasks.
func GetProcAndTaskStatus ¶
func GetProcAndTaskStatus(pid int) (ret ProcessAndTasks, err error)
GetProcAndTaskStatus returns the status and resource information about a process according to the information available from procfs. As a special case, if the input PID is 0, then the function will retrieve process status information from its own process ("self").
type ProcessCPUUsage ¶
type ProcessCPUUsage struct { NumUserModeSecInclChildren float64 NumSysModeSecInclChildren float64 }
ProcessCPUUsage describes the accumulated CPU usage of a process.
type ProcessMemUsage ¶
ProcessMemUsage describes the memory usage of a process.
type ProcessPrivilege ¶
ProcessPrivilege describes the the UID and GID under which a process runs.
type ProcessStats ¶
type ProcessStats struct { State string StartedAtUptimeSec int VirtualMemSizeBytes int ResidentSetMemSizeBytes int NumUserModeSecInclChildren float64 NumKernelModeSecInclChildren float64 }
ProcessStats describes overall resource usage of a process across all of its tasks.
type ProcessStatus ¶
type ProcessStatus struct { Name string Umask string ParentPID int ThreadGroupID int ProcessID int ProcessGroupID int SessionID int ProcessPrivilege ProcessPrivilege }
ProcessStatus describes the identity and privileges of a process or a process task.
type SchedulerStats ¶
type SchedulerStats struct { // From schedstat NumRunSec float64 NumWaitSec float64 // From sched NumVoluntarySwitches int NumInvoluntarySwitches int }
SchedulerStats describes the resource usage of a process task from scheduler's perspective.
type TaskStatus ¶
type TaskStatus struct { ID int KernelStack []string WaitChannelName string SchedulerStats SchedulerStats }
TaskStatus describes the scheduler status of a thread ("task") that belongs to a process.
func GetTaskStatus ¶
func GetTaskStatus(pid, taskID int) (status TaskStatus)
GetTaskStatus returns the stack information and scheduler stats for the specified task. As a special case, if the input process ID is 0, then the function will find the task (identified by ID) from its own process.