Documentation
¶
Overview ¶
ps provides an API for finding and listing processes in a platform-agnostic way.
NOTE: If you're reading these docs online via GoDocs or some other system, you might only see the Unix docs. This project makes heavy use of platform-specific implementations. We recommend reading the source if you are interested.
Index ¶
- Variables
- type Process
- type UnixProcess
- func (p *UnixProcess) Cgroup() string
- func (p *UnixProcess) Cmdline() []string
- func (p *UnixProcess) Cstime() int64
- func (p *UnixProcess) Cutime() int64
- func (p *UnixProcess) Executable() string
- func (p *UnixProcess) PPid() int
- func (p *UnixProcess) Pgrp() int
- func (p *UnixProcess) Pid() int
- func (p *UnixProcess) Refresh() error
- func (p *UnixProcess) Rss() uint32
- func (p *UnixProcess) Sid() int
- func (p *UnixProcess) Starttime() time.Time
- func (p *UnixProcess) Stime() time.Duration
- func (p *UnixProcess) Utime() time.Duration
- func (p *UnixProcess) Vsize() uint64
Constants ¶
This section is empty.
Variables ¶
var ( BootTime time.Time ClkTck int64 )
Functions ¶
This section is empty.
Types ¶
type Process ¶
type Process interface {
Pid() int
PPid() int
Pgrp() int
Sid() int
Executable() string
Cmdline() []string
Utime() time.Duration
Stime() time.Duration
Starttime() time.Time
Vsize() uint64
Rss() uint32
Cgroup() string
}
Process is the generic interface that is implemented on every platform and provides common operations for processes.
func FindProcess ¶
FindProcess looks up a single process by pid.
Process will be nil and error will be nil if a matching process is not found.
func Processes ¶
Processes returns all processes.
This of course will be a point-in-time snapshot of when this method was called. Some operating systems don't provide snapshot capability of the process table, in which case the process table returned might contain ephemeral entities that happened to be running when this was called.
type UnixProcess ¶
type UnixProcess struct {
// contains filtered or unexported fields
}
UnixProcess is an implementation of Process that contains Unix-specific fields and information.
func (*UnixProcess) Cgroup ¶
func (p *UnixProcess) Cgroup() string
func (*UnixProcess) Cmdline ¶
func (p *UnixProcess) Cmdline() []string
func (*UnixProcess) Cstime ¶
func (p *UnixProcess) Cstime() int64
func (*UnixProcess) Cutime ¶
func (p *UnixProcess) Cutime() int64
func (*UnixProcess) Executable ¶
func (p *UnixProcess) Executable() string
func (*UnixProcess) PPid ¶
func (p *UnixProcess) PPid() int
func (*UnixProcess) Pgrp ¶
func (p *UnixProcess) Pgrp() int
func (*UnixProcess) Pid ¶
func (p *UnixProcess) Pid() int
func (*UnixProcess) Refresh ¶
func (p *UnixProcess) Refresh() error
Refresh reloads all the data associated with this process.
func (*UnixProcess) Rss ¶
func (p *UnixProcess) Rss() uint32
func (*UnixProcess) Sid ¶
func (p *UnixProcess) Sid() int
func (*UnixProcess) Starttime ¶
func (p *UnixProcess) Starttime() time.Time
func (*UnixProcess) Stime ¶
func (p *UnixProcess) Stime() time.Duration
func (*UnixProcess) Utime ¶
func (p *UnixProcess) Utime() time.Duration
func (*UnixProcess) Vsize ¶
func (p *UnixProcess) Vsize() uint64
