proc

package
v0.0.0-...-d51e114 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProcStatPath        = "/proc/stat"
	ProcUptimePath      = "/proc/uptime"
	ProcNetDevPath      = "/proc/net/dev"
	ProcPath            = "/proc"
	PidLimitsPathFormat = "/%d/limits"
	PidFdPathFormat     = "/%d/fd"
	PidTaskPathFormat   = "/%d/task"
)

Variables

This section is empty.

Functions

func GetPidList

func GetPidList(procPath string) []int

func GetUptime

func GetUptime() (float64, error)

GetUptime collects uptime data

func SearchProcsForEnvVariable

func SearchProcsForEnvVariable(procPath string, envName string) []string

SearchProcsForEnvVariable returns values of the given env variable name it returns a slice since a value could be found in more than one process

Types

type CPUData

type CPUData struct {
	TotalUserTimeMs   float64
	TotalSystemTimeMs float64
	TotalIdleTimeMs   float64
	// Maps CPU core name (e.g. "cpu1") to time in ms that the CPU spent in the idle process
	IndividualCPUIdleTimes map[string]float64
}

func GetCPUData

func GetCPUData() (*CPUData, error)

GetCPUData collects aggregated and per-core CPU usage data

type FileDescriptorMaxData

type FileDescriptorMaxData struct {
	MaximumFileHandles float64
}

func GetFileDescriptorMaxData

func GetFileDescriptorMaxData(pids []int) (*FileDescriptorMaxData, error)

GetFileDescriptorMaxData returns the maximum limit of file descriptors the function can use

type FileDescriptorUseData

type FileDescriptorUseData struct {
	UseFileHandles float64
}

func GetFileDescriptorUseData

func GetFileDescriptorUseData(pids []int) (*FileDescriptorUseData, error)

GetFileDescriptorUseData returns the maximum number of file descriptors the function has used at a time

type NetworkData

type NetworkData struct {
	RxBytes float64
	TxBytes float64
}

func GetNetworkData

func GetNetworkData() (*NetworkData, error)

GetNetworkData collects bytes sent and received by the function

type ThreadsMaxData

type ThreadsMaxData struct {
	ThreadsMax float64
}

func GetThreadsMaxData

func GetThreadsMaxData(pids []int) (*ThreadsMaxData, error)

GetThreadsMaxData returns the maximum limit of threads the function can use

type ThreadsUseData

type ThreadsUseData struct {
	ThreadsUse float64
}

func GetThreadsUseData

func GetThreadsUseData(pids []int) (*ThreadsUseData, error)

GetThreadsUseData returns the maximum number of threads the function has used at a time

Jump to

Keyboard shortcuts

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