myos

package
v0.0.0-...-1107578 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2018 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateCpuPercent

func CalculateCpuPercent(t1, t2 *cpu.TimesStat, delta float64, numcpu int) float64

func CheckGreaterZero

func CheckGreaterZero(f float64) float64

func GetMaxPerCpuPerMetric

func GetMaxPerCpuPerMetric(p []PercentPerCpuPerMetric) map[string]*MaxPerCpuPerMetric

func GetNetIfaces

func GetNetIfaces(onlyPrefix []string) ([]string, error)

Inter-| Receive | Transmit

face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
 eth0: 1990350    2838    0    0    0     0          0         0   401351    2218    0    0    0     0       0          0
   lo:   26105     286    0    0    0     0          0         0    26105     286    0    0    0     0       0          0

func GetProcessCpuInterval

func GetProcessCpuInterval(p *process.Process, interval uint32) (float64, error)

func GetProcessCpuPercentInterval

func GetProcessCpuPercentInterval(pid int32, interval uint32) (float64, error)

func SumCpuTimePerCpu

func SumCpuTimePerCpu(t cpu.TimesStat) float64

Types

type CpuTimes

type CpuTimes struct {
	TheCPUTimes *cpu.TimesStat
	TheCPUTime  time.Time
}

func GetProcessCpuTimes

func GetProcessCpuTimes(pid int32) (CpuTimes, error)

type MaxPerCpuPerMetric

type MaxPerCpuPerMetric struct {
	Name   string
	Value  float64
	CpuIdx int
}

type OSMemStats

type OSMemStats struct {
	SwapTotal       uint64
	SwapUsed        uint64
	SwapFree        uint64
	SwapUsedPercent float64
	SwapIn          uint64
	SwapOut         uint64

	MemTotal       uint64
	MemAvailable   uint64
	MemUsed        uint64
	MemUsedPercent float64
	MemBuffers     uint64
	MemCached      uint64
}

func GetOsMemStats

func GetOsMemStats() (OSMemStats, error)

type PercentPerCpuPerMetric

type PercentPerCpuPerMetric struct {
	User      float64 `json:"user"`
	System    float64 `json:"system"`
	Idle      float64 `json:"idle"`
	Nice      float64 `json:"nice"`
	Iowait    float64 `json:"iowait"`
	Irq       float64 `json:"irq"`
	Softirq   float64 `json:"softirq"`
	Steal     float64 `json:"steal"`
	Guest     float64 `json:"guest"`
	GuestNice float64 `json:"guestNice"`
	Stolen    float64 `json:"stolen"`
}

func CalculateCpuPercentPerCpuPerMetric

func CalculateCpuPercentPerCpuPerMetric(cpuTs1, cpuTs2 []cpu.TimesStat) []PercentPerCpuPerMetric

type ProcessStats

type ProcessStats struct {
	FirstErr bool

	MemPercent   float64
	GetMemPerErr bool

	GetMemErr bool
	MemRSS    uint64
	MemVMS    uint64
	MemSwap   uint64

	GetIoErr  bool
	IoRdcnt   uint64
	IoWrcnt   uint64
	IoRdBytes uint64
	IoWrBytes uint64

	GetCtxErr            bool
	CtxSwitchVoluntary   int64
	CtxSwitchInvoluntary int64
}

func GetProcessStatsWithoutCpu

func GetProcessStatsWithoutCpu(pid int32) (ProcessStats, error)

Jump to

Keyboard shortcuts

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