manager

package
v0.5.39 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IrqRootPath    = "/proc/irq"
	InterruptsFile = "/proc/interrupts"
)

Variables

This section is empty.

Functions

func ApplyProcInterrupts

func ApplyProcInterrupts(irqNumber int, cpuset string) error

ApplyProcInterrupts applies the given cpuset to the given irq number.

func GetCPUInfo

func GetCPUInfo() ([]procfs.CPUInfo, error)

GetCPUInfo returns the CPUInfo of the host.

func GetIPVSStats

func GetIPVSStats() (procfs.IPVSStats, error)

GetIPVSStats returns the IPVSStats of the host.

func GetMounts

func GetMounts() ([]*procfs.MountInfo, error)

GetMounts returns the mounts of the host.

func GetNetDev

func GetNetDev() (map[string]procfs.NetDevLine, error)

GetNetDev returns the net dev of the host.

func GetNetSoftnetStat

func GetNetSoftnetStat() ([]procfs.SoftnetStat, error)

GetNetSoftnetStat returns the net softnet stat of the host.

func GetNetStat

func GetNetStat() ([]procfs.NetStat, error)

GetNetStat returns the net stat of the host.

func GetNetTCP

func GetNetTCP() (procfs.NetTCP, error)

GetNetTCP returns the net TCP of the host.

func GetNetTCP6

func GetNetTCP6() (procfs.NetTCP, error)

GetNetTCP6 returns the net TCP6 of the host.

func GetNetUDP

func GetNetUDP() (procfs.NetUDP, error)

GetNetUDP returns the net UDP of the host.

func GetNetUDP6

func GetNetUDP6() (procfs.NetUDP, error)

GetNetUDP6 returns the net UDP6 of the host.

func GetPSIStatsForResource

func GetPSIStatsForResource(resourceName string) (procfs.PSIStats, error)

GetPSIStatsForResource returns the psi stats for the given resource.

func GetPidCgroups

func GetPidCgroups(pid int) ([]procfs.Cgroup, error)

GetPidCgroups returns the cgroups of the given pid.

func GetPidCmdline

func GetPidCmdline(pid int) ([]string, error)

GetPidCmdline returns the cmdline of the given pid.

func GetPidComm

func GetPidComm(pid int) (string, error)

GetPidComm returns the comm of the given pid.

func GetProcInterrupts

func GetProcInterrupts() (procfs.Interrupts, error)

GetProcInterrupts returns the proc interrupts of the host.

func GetProcMounts

func GetProcMounts(pid int) ([]*procfs.MountInfo, error)

GetProcMounts returns the mounts of the given pid.

func GetProcStat

func GetProcStat() (procfs.Stat, error)

GetProcStat returns the Stat of the host.

func GetSchedStat

func GetSchedStat() (*procfs.Schedstat, error)

GetSchedStat returns the sched stat of the host.

func GetSoftirqs

func GetSoftirqs() (procfs.Softirqs, error)

GetSoftirqs returns the softirqs of the host.

func GetTaskSchedWait

func GetTaskSchedWait(pids []int) (map[int]uint64, error)

https://docs.kernel.org/scheduler/sched-stats.html#proc-pid-schedstat schedwait unit: nanosecond

func NewProcFSManager

func NewProcFSManager() *manager

NewProcFSManager return a manager for procfs

func ReadFileNoStat

func ReadFileNoStat(filename string) ([]byte, error)

ReadFileNoStat uses io.ReadAll to read contents of entire file. This is similar to os.ReadFile but without the call to os.Stat, because many files in /proc and /sys report incorrect file sizes (either 0 or 4096). Reads a max file size of 1024kB. For files larger than this, a scanner should be used.

Types

type ProcFSManager

type ProcFSManager interface {
	GetCPUInfo() ([]procfs.CPUInfo, error)
	GetProcStat() (procfs.Stat, error)
	GetPidComm(pid int) (string, error)
	GetPidCmdline(pid int) ([]string, error)
	GetPidCgroups(pid int) ([]procfs.Cgroup, error)
	GetMounts() ([]*procfs.MountInfo, error)
	GetProcMounts(pid int) ([]*procfs.MountInfo, error)
	GetIPVSStats() (procfs.IPVSStats, error)
	GetNetDev() (map[string]procfs.NetDevLine, error)
	GetNetStat() ([]procfs.NetStat, error)
	GetNetSoftnetStat() ([]procfs.SoftnetStat, error)
	GetNetTCP() (procfs.NetTCP, error)
	GetNetTCP6() (procfs.NetTCP, error)
	GetNetUDP() (procfs.NetUDP, error)
	GetNetUDP6() (procfs.NetUDP, error)
	GetSoftirqs() (procfs.Softirqs, error)
	GetProcInterrupts() (procfs.Interrupts, error)
	GetPSIStatsForResource(resourceName string) (procfs.PSIStats, error)
	GetSchedStat() (*procfs.Schedstat, error)

	ApplyProcInterrupts(irqNumber int, cpuset string) error
}

func GetProcFSManager

func GetProcFSManager() ProcFSManager

GetProcFSManager returns the singleton ProcFSManager.

Jump to

Keyboard shortcuts

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