sys_monitor

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT, MIT, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CpuPercentCurrProcess

func CpuPercentCurrProcess() float64

func CpuPercentPid

func CpuPercentPid(sleepTime, pid int) float64

Types

type Process

type Process struct {
	Pid int

	// Get percent for oneshot usage
	CpuPercentGet func() float64

	// Handle retrieving percent over time using goroutine
	// until CpuPercentSetAutoRefresh(false)
	CpuPercentSetAutoRefresh func(_ bool)

	CpuPercentAuto float64

	Desc []*itemStatFileDescr
	// contains filtered or unexported fields
}

func (*Process) GetProcess

func (p *Process) GetProcess(pid int)

func (*Process) GetStat

func (prc *Process) GetStat() (*StatsPid, error)

func (*Process) GetStatus

func (prc *Process) GetStatus() (*StatsPid, error)

func (*Process) Write

func (p *Process) Write(filename string)

type StatsPid

type StatsPid struct {
	Data map[string]*statPid
	sync.RWMutex
}

func StatsPidNew

func StatsPidNew() StatsPid

Create a map to hold retrieved values.

type SystemMonitorStruct

type SystemMonitorStruct struct {
	Temp    []*device
	CPUs    *cpus
	Memory  *memory
	Swaps   *swaps
	Process *Process

	LinuxMeminfo,
	LinuxSwaps,
	LinuxHwmonDir,
	LinuxCpufreq,
	LinuxUptime,
	LinuxPidStat,
	LinuxPidStatus string // process/system information.
}

func SystemMonitorStructNew

func SystemMonitorStructNew() *SystemMonitorStruct

func (*SystemMonitorStruct) GetMemory

func (sms *SystemMonitorStruct) GetMemory() error

GetMemory:

func (*SystemMonitorStruct) GetProcessors

func (sms *SystemMonitorStruct) GetProcessors() error

GetProcessors:

func (*SystemMonitorStruct) GetSwaps

func (sms *SystemMonitorStruct) GetSwaps() error

GetSwaps:

func (*SystemMonitorStruct) GetTemp

func (sms *SystemMonitorStruct) GetTemp() (err error)

func (*SystemMonitorStruct) InitProcess

func (sms *SystemMonitorStruct) InitProcess(pid int) (err error)

GetProcess:

func (*SystemMonitorStruct) Write

func (sms *SystemMonitorStruct) Write(filename string) error

Jump to

Keyboard shortcuts

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