procutil

package
v0.0.0-...-0ffce00 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CPUTop

func CPUTop() error

CPUTop will list all the process in a tabular form

func GetPids

func GetPids() (pids []string, err error)

GetPids returns a slice of IDs for all of the currently running processes

func GetProcessTree

func GetProcessTree() gotree.Tree

GetProcessTree returns a tree with process ancestral hierarchy

func ListProcess

func ListProcess() error

ListProcess will list all the process in a tabular form

func MemTop

func MemTop() error

MemTop will list all the process in a tabular form

func OrderedBy

func OrderedBy(less ...lessFunc) *multiSorter

OrderedBy returns a Sorter that sorts using the less functions, in order. Call its Sort method to sort the data.

func PrintProcessTree

func PrintProcessTree()

PrintProcessTree prints a tree of processes with their ancestral hierarchy

func Top

func Top(ps []*Process, res string) error

Top will return top result for RAM and CPU

Types

type Process

type Process struct {
	Pid     int
	Name    string
	Ppid    int
	Stat    Stat
	User    string
	Cmdline string
	Cput    float64
	Cpup    float64
	Memp    float32
}

Process represents a process

func GetProcessStats

func GetProcessStats() ([]*Process, error)

GetProcessStats returns a list of processes with their respective info

func (*Process) ExternalStats

func (p *Process) ExternalStats() error

ExternalStats get stats from the gopsutil

func (*Process) GetStat

func (p *Process) GetStat() (err error)

GetStat will return the stats for a given process

func (*Process) GetStatus

func (p *Process) GetStatus() (err error)

GetStatus parses the status file of a process and gets the process's UID and VmRSS

func (*Process) GetUserName

func (p *Process) GetUserName(s string) (err error)

GetUserName returns info about the real user of a process

func (*Process) GetVMRss

func (p *Process) GetVMRss(s string) (err error)

GetVMRss returns the virtual memory resident set size of a process

func (*Process) IsGhostProcess

func (p *Process) IsGhostProcess() bool

type Stat

type Stat struct {
	State               string
	Pgrp                int
	Session             int
	TtyNr               int
	Tpgid               int
	Flags               uint
	Minflt              int
	Cminflt             int
	Majflt              int
	Cmajflt             int
	Utime               int
	Stime               int
	Cutime              int64
	Cstime              int64
	Priority            int64
	Nice                int64
	NumThreads          int64
	Itrealvalue         int64
	Starttime           int64
	Vsize               int
	Rss                 int64
	Rsslim              uint64
	Signal              int
	Blocked             int
	Sigignore           int
	Sigcatch            int
	Nswap               int
	Cnswap              int
	ExitSignal          int
	Processor           int
	RtPriority          uint
	Policy              uint
	DelayacctBlkioTicks uint64
	GuestTime           int
	CguestTime          int64
	StartData           int
	EndData             int
	StartBrk            int
	ArgStart            int
	ArgEnd              int
	EnvStart            int
	EnvEnd              int
	ExitCode            int
}

Stat represents all of the info found about a process

Jump to

Keyboard shortcuts

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