Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBootTime ¶
func GetClockTick ¶
func GetClockTick() uint64
Types ¶
type Process ¶
type Process interface { // Pid is the process ID for this process. Pid() uint // Command name running this process. This is not a path to the // executable. Command() string RunTime() uint64 UserName() string }
Process is the generic interface that is implemented on every platform and provides common operations for processes.
func FindProcess ¶
FindProcess looks up a single process by pid.
Process will be nil and error will be nil if a matching process is not found.
type UnixProcess ¶
type UnixProcess struct {
// contains filtered or unexported fields
}
UnixProcess is an implementation of Process that contains Unix-specific fields and information.
func (*UnixProcess) Command ¶
func (p *UnixProcess) Command() string
func (*UnixProcess) Pid ¶
func (p *UnixProcess) Pid() uint
func (*UnixProcess) Refresh ¶
func (p *UnixProcess) Refresh() error
// https://kb.novaordis.com/index.php/Linux_Process_Information (1) pid %d The process ID (2) comm %s The filename of the executable, in parentheses. (3) state %c (4) ppid %d The PID of the parent of this process. (5) pgrp %d The process group ID of the process. (6) session %d The session ID of the process. (7) tty_nr %d The controlling terminal of the process. (8) tpgid %d The ID of the foreground process group (9) flags %u The kernel flags word of the process. (10) minflt %lu The number of minor faults the process has made (11) cminflt %lu The number of minor faults that the process's waited-for children have made. (12) majflt %lu The number of major faults the process has made (13) cmajflt %lu The number of major faults that the process's (14) utime %lu Amount of time that this process has been scheduled in user mode (15) stime %lu Amount of time that this process has been scheduled in kernel mode (16) cutime %ld Amount of time that this process's waited-for chil (17) cstime %ld Amount of time that this process's waited-for chil (18) priority %ld (19) nice %ld The nice value (see setpriority(2)) (20) num_threads %ld Number of threads in this process (21) itrealvalue %ld The time in jiffies before the next SIGALRM (22) starttime %llu The time the process started after system boot (clock ticks (divide by sysconf(_SC_CLK_TCK)). ...
Refresh reloads all the data associated with this process.
func (*UnixProcess) RunTime ¶
func (p *UnixProcess) RunTime() uint64
func (*UnixProcess) UserName ¶
func (p *UnixProcess) UserName() string
Click to show internal directories.
Click to hide internal directories.