Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSampler ¶
NewSampler returns a channel to which process information will be sent every 'rate' moment. It will contain an average CPU utilization during that time. The channel will be closed when the context is done. If any error occurs during the sampling, the information sent will be zeroed.
Types ¶
type ProcessInfo ¶
type ProcessInfo struct {
CPU float64 // Percentage of overall CPU utilization by the process.
Memory uint64 // Memory used by the process in bytes.
}
func Get ¶
func Get(pid int) (*ProcessInfo, error)
Get returns resources used by the process in the current instant.
It will contain very inaccurate CPU utilization value as it has no time reference. Use 'processinfo.NewSampler' to get an accurate value on ongoing basis.
Click to show internal directories.
Click to hide internal directories.