procexp

package
v0.0.0-...-44b4573 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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

func GetProcTaskIDs(pid int) (ret []int)

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

type ProcessMemUsage struct {
	VirtualMemSizeBytes     int
	ResidentSetMemSizeBytes int
}

ProcessMemUsage describes the memory usage of a process.

type ProcessPrivilege

type ProcessPrivilege struct {
	RealUID      int
	EffectiveUID int
	RealGID      int
	EffectiveGID int
}

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.

Jump to

Keyboard shortcuts

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