process

package
v0.0.0-...-a6a64ce Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PidExists

func PidExists(pid int32) (bool, error)

Types

type IOCountersStat

type IOCountersStat struct {
	ReadCount  uint64 `json:"readCount"`
	WriteCount uint64 `json:"writeCount"`
	ReadBytes  uint64 `json:"readBytes"`
	WriteBytes uint64 `json:"writeBytes"`
}

func (IOCountersStat) String

func (i IOCountersStat) String() string

type MemoryInfoStat

type MemoryInfoStat struct {
	RSS  uint64 `json:"rss"`  // bytes
	VMS  uint64 `json:"vms"`  // bytes
	Swap uint64 `json:"swap"` // bytes
}

func (MemoryInfoStat) String

func (m MemoryInfoStat) String() string

type NumCtxSwitchesStat

type NumCtxSwitchesStat struct {
	Voluntary   int64 `json:"voluntary"`
	Involuntary int64 `json:"involuntary"`
}

func (NumCtxSwitchesStat) String

func (p NumCtxSwitchesStat) String() string

type OpenFilesStat

type OpenFilesStat struct {
	Path string `json:"path"`
	Fd   uint64 `json:"fd"`
}

func (OpenFilesStat) String

func (o OpenFilesStat) String() string

type Process

type Process struct {
	Pid int32 `json:"pid"`
	// contains filtered or unexported fields
}

func (*Process) Kill

func (p *Process) Kill() error

Kill sends SIGKILL to the process.

func (*Process) MemoryPercent

func (p *Process) MemoryPercent() (float32, error)

MemoryPercent returns how many percent of the total RAM this process uses

func (*Process) Percent

func (p *Process) Percent(interval time.Duration) (float64, error)

If interval is 0, return difference from last call(non-blocking). If interval > 0, wait interval sec and return diffrence between start and end.

func (*Process) Resume

func (p *Process) Resume() error

Resume sends SIGCONT to the process.

func (*Process) SendSignal

func (p *Process) SendSignal(sig syscall.Signal) error

SendSignal sends a syscall.Signal to the process. Currently, SIGSTOP, SIGCONT, SIGTERM and SIGKILL are supported.

func (Process) String

func (p Process) String() string

func (*Process) Suspend

func (p *Process) Suspend() error

Suspend sends SIGSTOP to the process.

func (*Process) Terminate

func (p *Process) Terminate() error

Terminate sends SIGTERM to the process.

func (*Process) Username

func (p *Process) Username() (string, error)

Username returns a username of the process.

type RlimitStat

type RlimitStat struct {
	Resource int32 `json:"resource"`
	Soft     int32 `json:"soft"`
	Hard     int32 `json:"hard"`
}

func (RlimitStat) String

func (r RlimitStat) String() string

Jump to

Keyboard shortcuts

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