Documentation
¶
Overview ¶
Package ps which runs 'ps' unix command and returns the process information.
package main
import (
"fmt"
"github.com/umahmood/ps"
)
func main() {
proc, err := ps.Snapshot("firefox")
if err != nil {
fmt.Println(err)
return
}
fmt.Println(proc.PID)
fmt.Println("")
fmt.Println(proc)
}
Index ¶
Constants ¶
View Source
const ( Major = 1 Minor = 0 Patch = 0 )
Semantic versioning - http://semver.org/
Variables ¶
View Source
var ( // ErrEmptyProcName process name is empty ErrEmptyProcName = errors.New("ps process name is empty") // ErrProcNotFound process not found ErrProcNotFound = errors.New("ps process not found") // ErrMultipleProcs matched multiple processes ErrMultipleProcs = errors.New("ps matched multiple processes") // ErrParsingPSOutput error parsing ps output ErrParsingPSOutput = errors.New("ps error parsing ps output") )
Functions ¶
Types ¶
type PS ¶
type PS struct {
USER string // username of the process's owner
PID int64 // process ID number
CPU float64 // how much of the CPU the process is using
MEM float64 // how much memory the process is using
VSZ int64 // virtual memory usage
RSS int64 // real memory usage
TTY string // terminal associated with the process
STAT string // process status code
START string // time when the process started
TIME string // total CPU usage
COMMAND string // name of the process, including arguments, if any
}
PS process information
Click to show internal directories.
Click to hide internal directories.