package process

import "github.com/shirou/gopsutil/process"

Index

Constants

const (
	NoMoreFiles   = 0x12
	MaxPathLength = 260
)

Functions

func PidExists

func PidExists(pid int32) (bool, error)

func Pids

func Pids() ([]int32, 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 MemoryInfoExStat

type MemoryInfoExStat struct {
}

Memory_info_ex is different between OSes

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 MemoryMapsStat

type MemoryMapsStat struct {
}

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 NewProcess

func NewProcess(pid int32) (*Process, error)

func (*Process) CPUAffinity

func (p *Process) CPUAffinity() ([]int32, error)

func (*Process) Children

func (p *Process) Children() ([]*Process, error)

func (*Process) Cmdline

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

func (*Process) CmdlineSlice

func (p *Process) CmdlineSlice() ([]string, error)

CmdlineSlice returns the command line arguments of the process as a slice with each element being an argument. This merely returns the CommandLine informations passed to the process split on the 0x20 ASCII character.

func (*Process) Connections

func (p *Process) Connections() ([]net.ConnectionStat, error)

func (*Process) CreateTime

func (p *Process) CreateTime() (int64, error)

func (*Process) Cwd

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

func (*Process) Exe

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

func (*Process) Gids

func (p *Process) Gids() ([]int32, error)

func (*Process) IOCounters

func (p *Process) IOCounters() (*IOCountersStat, error)

func (*Process) IOnice

func (p *Process) IOnice() (int32, error)

func (*Process) IsRunning

func (p *Process) IsRunning() (bool, error)

func (*Process) Kill

func (p *Process) Kill() error

func (*Process) MemoryInfo

func (p *Process) MemoryInfo() (*MemoryInfoStat, error)

func (*Process) MemoryInfoEx

func (p *Process) MemoryInfoEx() (*MemoryInfoExStat, error)

func (*Process) MemoryMaps

func (p *Process) MemoryMaps(grouped bool) (*[]MemoryMapsStat, error)

func (*Process) MemoryPercent

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

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

func (*Process) Name

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

func (*Process) NetIOCounters

func (p *Process) NetIOCounters(pernic bool) ([]net.IOCountersStat, error)

func (*Process) Nice

func (p *Process) Nice() (int32, error)

Nice returnes priority in Windows

func (*Process) NumCtxSwitches

func (p *Process) NumCtxSwitches() (*NumCtxSwitchesStat, error)

func (*Process) NumFDs

func (p *Process) NumFDs() (int32, error)

func (*Process) NumThreads

func (p *Process) NumThreads() (int32, error)

func (*Process) OpenFiles

func (p *Process) OpenFiles() ([]OpenFilesStat, error)

func (*Process) Parent

func (p *Process) Parent() (*Process, error)

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) Ppid

func (p *Process) Ppid() (int32, error)

func (*Process) Resume

func (p *Process) Resume() error

func (*Process) Rlimit

func (p *Process) Rlimit() ([]RlimitStat, error)

func (*Process) SendSignal

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

func (*Process) Status

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

func (Process) String

func (p Process) String() string

func (*Process) Suspend

func (p *Process) Suspend() error

func (*Process) Terminal

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

func (*Process) Terminate

func (p *Process) Terminate() error

func (*Process) Threads

func (p *Process) Threads() (map[string]string, error)

func (*Process) Times

func (p *Process) Times() (*cpu.TimesStat, error)

func (*Process) Uids

func (p *Process) Uids() ([]int32, error)

func (*Process) Username

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

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

type SystemProcessInformation

type SystemProcessInformation struct {
	NextEntryOffset   uint64
	NumberOfThreads   uint64
	Reserved1         [48]byte
	Reserved2         [3]byte
	UniqueProcessID   uintptr
	Reserved3         uintptr
	HandleCount       uint64
	Reserved4         [4]byte
	Reserved5         [11]byte
	PeakPagefileUsage uint64
	PrivatePageCount  uint64
	Reserved6         [6]uint64
}

type Win32_Process

type Win32_Process struct {
	Name           string
	ExecutablePath *string
	CommandLine    *string
	Priority       uint32
	CreationDate   *time.Time
	ProcessID      uint32
	ThreadCount    uint32
}

func GetWin32Proc

func GetWin32Proc(pid int32) ([]Win32_Process, error)

Source Files

process.go process_windows.go

Version
v2.0.0+incompatible
Published
Apr 7, 2016
Platform
windows/amd64
Imports
14 packages
Last checked
7 hours ago

Tools for package owners.