proc

package
v0.0.0-...-c202275 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Duration

func Duration(v uint64) time.Duration

Types

type ProcStat

type ProcStat struct {

	// The process ID.
	Pid int

	// The filename of the executable, in parentheses. Strings longer than
	// TASK_COMM_LEN (16) characters (including the terminating null byte) are
	// silently truncated. This is visible whether or not the executable is
	// swapped out.
	Comm string

	// One of the following characters, indicating process state:
	//
	//   R  Running
	//   S  Sleeping in an interruptible wait
	//   T  Waiting in uninterruptible disk sleep
	//   U  Zombie
	//   V  Stopped (on a signal) or (before Linux 2.6.33) trace stopped
	//   t  Tracing stop (Linux 2.6.33 onward)
	//   W  Paging (only before Linux 2.6.0)
	//   X  Dead (from Linux 2.6.0 onward)
	//   x  Dead (Linux 2.6.33 to 3.13 only)
	//   K  Wakekill (Linux 2.6.33 to 3.13 only)
	//   L  Waking (Linux 2.6.33 to 3.13 only)
	//   M  Parked (Linux 3.9 to 3.13 only)
	State rune

	// The PID of the parent of this process.
	Ppid int

	// The process group ID of the process.
	Pgrp int

	// The session ID of the process.
	Session int

	// The controlling terminal of the process. (The minor device number is
	// contained in the combination of bits 31 to 20 and 7 to 0; the major
	// device number is in bits 15 to 8.)
	TtyNr int

	// The ID of the foreground process group of the controlling terminal of
	// the process.
	Tpgid int

	// The kernel flags word of the process. For bit meanings, see the PF_*
	// defines in the Linux kernel source file include/linux/sched.h. Details
	// depend on the kernel version.
	//
	// The format for this field was %lu before Linux 2.6.
	Flags uint

	// The number of minor faults the process has made which have not required
	// loading a memory page from disk.
	Minflt uint64

	// The number of minor faults that the process's waited-for children have
	// made.
	Cminflt uint64

	// The number of major faults the process has made which have required
	// loading a memory page from disk.
	Majflt uint64

	// The number of major faults that the process's waited-for children have
	// made.
	Cmajflt uint64

	// Amount of time that this process has been scheduled in user mode,
	// measured in clock ticks (divide by sysconf(_SC_CLK_TCK)). This includes
	// guest time, guest_time (time spent running a virtual CPU, see below),
	// so that applications that are not aware of the guest time field do not
	// lose that time from their calculations.
	Utime uint64

	// Amount of time that this process has been scheduled in kernel mode,
	// measured in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	Stime uint64

	// Amount of time that this process's waited-for children have been
	// scheduled in user mode, measured in clock ticks (divide by
	// sysconf(_SC_CLK_TCK)). (See also times(2).) This includes guest time,
	// cguest_time (time spent running a virtual CPU, see below).
	Cutime int64

	// Amount of time that this process's waited-for children have been
	// scheduled in kernel mode, measured in clock ticks (divide by
	// sysconf(_SC_CLK_TCK)).
	Cstime int64

	// (Explanation for Linux 2.6) For processes running a real-time
	// scheduling policy (policy below; see sched_setscheduler(2)), this is
	// the negated scheduling priority, minus one; that is, a number in the
	// range -2 to -100, corresponding to real-time priorities 1 to 99. For
	// processes running under a non-real-time scheduling policy, this is the
	// raw nice value (setpriority(2)) as represented in the kernel. The
	// kernel stores nice values as numbers in the range 0 (high) to 39 (low),
	// corresponding to the user-visible nice range of -20 to 19.
	//
	// Before Linux 2.6, this was a scaled value based on the scheduler
	// weighting given to this process.
	Priority int64

	// The nice value (see setpriority(2)), a value in the range 19 (low
	// priority) to -20 (high priority).
	Nice int64

	// Number of threads in this process (since Linux 2.6). Before kernel 2.6,
	// this field was hard coded to 0 as a placeholder for an earlier removed
	// field.
	NumThreads int64

	// The time in jiffies before the next SIGALRM is sent to the process due
	// to an interval timer. Since kernel 2.6.17, this field is no longer
	// maintained, and is hard coded as 0.
	Itrealvalue int64

	// The time the process started after system boot. In kernels before Linux
	// 2.6, this value was expressed in jiffies. Since Linux 2.6, the value is
	// expressed in clock ticks (divide by sysconf(_SC_CLK_TCK)).
	//
	// The format for this field was %lu before Linux 2.6.
	Starttime uint64

	// Virtual memory size in bytes.
	Vsize uint64

	// Resident Set Size: number of pages the process has in real memory. This
	// is just the pages which count toward text, data, or stack space. This
	// does not include pages which have not been demand-loaded in, or which
	// are swapped out. This value is inaccurate; see /proc/[pid]/statm below.
	Rss int64

	// Current soft limit in bytes on the rss of the process; see the
	// description of RLIMIT_RSS in getrlimit(2).
	Rsslim uint64

	// The address above which program text can run.
	Startcode uint64

	// The address below which program text can run.
	Endcode uint64

	// The address of the start (i.e., bottom) of the stack.
	Startstack uint64

	// The current value of ESP (stack pointer), as found in the kernel stack
	// page for the process.
	Kstkesp uint64

	// The current EIP (instruction pointer).
	Kstkeip uint64

	// The bitmap of pending signals, displayed as a decimal number. Obsolete,
	// because it does not provide information on real-time signals; use
	// /proc/[pid]/status instead.
	Signal uint64

	// The bitmap of blocked signals, displayed as a decimal number. Obsolete,
	// because it does not provide information on real-time signals; use
	// /proc/[pid]/status instead.
	Blocked uint64

	// The bitmap of ignored signals, displayed as a decimal number. Obsolete,
	// because it does not provide information on real-time signals; use
	// /proc/[pid]/status instead.
	Sigignore uint64

	// The bitmap of caught signals, displayed as a decimal number. Obsolete,
	// because it does not provide information on real-time signals; use
	// /proc/[pid]/status instead.
	Sigcatch uint64

	// This is the "channel" in which the process is waiting. It is the
	// address of a location in the kernel where the process is sleeping. The
	// corresponding symbolic name can be found in /proc/[pid]/wchan.
	Wchan uint64

	// Number of pages swapped (not maintained).
	Nswap uint64

	// Cumulative nswap for child processes (not maintained).
	Cnswap uint64

	// Signal to be sent to parent when we die.
	ExitSignal int

	// CPU number last executed on.
	Processor int

	// Real-time scheduling priority, a number in the range 1 to 99 for
	// processes scheduled under a real-time policy, or 0, for non-real-time
	// processes (see sched_setscheduler(2)).
	RtPriority uint

	// Scheduling policy (see sched_setscheduler(2)). Decode using the SCHED_*
	// constants in linux/sched.h.
	//
	// The format for this field was %lu before Linux 2.6.22.
	Policy uint

	// Aggregated block I/O delays, measured in clock ticks (centiseconds).
	DelayacctBlkioTicks uint64

	// Guest time of the process (time spent running a virtual CPU for a guest
	// operating system), measured in clock ticks (divide by
	// sysconf(_SC_CLK_TCK)).
	GuestTime uint64

	// Guest time of the process's children, measured in clock ticks (divide
	// by sysconf(_SC_CLK_TCK)).
	CguestTime int64

	// Address above which program initialized and uninitialized (BSS) data
	// are placed.
	StartData uint64

	// Address below which program initialized and uninitialized (BSS) data
	// are placed.
	EndData uint64

	// Address above which program heap can be expanded with brk(2).
	StartBrk uint64

	// Address above which program command-line arguments (argv) are placed.
	ArgStart uint64

	// Address below program command-line arguments (argv) are placed.
	ArgEnd uint64

	// Address above which program environment is placed.
	EnvStart uint64

	// Address below which program environment is placed.
	EnvEnd uint64

	// The thread's exit status in the form reported by waitpid(2).
	ExitCode int
}

func Parse

func Parse(s string) (*ProcStat, error)

Jump to

Keyboard shortcuts

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