process

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LookupGID

func LookupGID(gid string) (string, error)

LookupGID returns the textual group ID, if it can be obtained, or the decimal representation otherwise.

func LookupUID

func LookupUID(uid string) (string, error)

LookupUID return the textual user ID, if it can be obtained, or the decimal representation otherwise.

Types

type Process

type Process struct {
	// PID is the process ID.
	Pid string
	// Stat contains data from /proc/$pid/stat.
	Stat proc.Stat
	// Status contains data from /proc/$pid/status.
	Status proc.Status
	// CmdLine contains data from /proc/$pid/cmdline.
	CmdLine []string
	// Label containers data from /proc/$pid/attr/current.
	Label string
	// PidNS contains data from /proc/$pid/ns/pid.
	PidNS string
	// Huser is the effective host user of a container process.
	Huser string
	// Hgroup is the effective host group of a container process.
	Hgroup string
}

Process includes process-related from the /proc FS.

func FromPIDs

func FromPIDs(pids []string, joinUserNS bool) ([]*Process, error)

FromPIDs creates a new Process for each pid.

func New

func New(pid string, joinUserNS bool) (*Process, error)

New returns a new Process with the specified pid and parses the relevant data from /proc and /dev.

func (*Process) CPUTime

func (p *Process) CPUTime() (time.Duration, error)

CPUTime returns the cumlative CPU time of process p as a time.Duration.

func (*Process) ElapsedTime

func (p *Process) ElapsedTime() (time.Duration, error)

ElapsedTime returns the time.Duration since process p was created.

func (*Process) SetHostData

func (p *Process) SetHostData() error

SetHostData sets all host-related data fields.

func (*Process) StartTime

func (p *Process) StartTime() (time.Time, error)

StartTime returns the time.Time when process p was started.

Jump to

Keyboard shortcuts

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