proc

package
v0.0.0-...-8365721 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CPUInfoPath is the patch to cpuinfo
	CPUInfoPath = "/proc/cpuinfo"
	// MountInfoPath is the mount info path
	MountInfoPath = "/proc/self/mountinfo"
	// ResctrlPath is the patch to resctrl
	ResctrlPath = "/sys/fs/resctrl"
)

Variables

View Source
var ListProcesses = func() map[string]Process {
	processes := make(map[string]Process)
	files, _ := filepath.Glob("/proc/[0-9]*/cmdline")
	for _, file := range files {

		listfs := strings.Split(file, "/")
		if pid, err := strconv.Atoi(listfs[2]); err == nil {

			cmd, _ := ioutil.ReadFile(file)
			cmdString := strings.Join(strings.Split(string(cmd), "\x00"), " ")
			processes[listfs[2]] = Process{pid, cmdString}
		}
	}

	return processes
}

ListProcesses returns all process on the host

Functions

func GetCPUAffinity

func GetCPUAffinity(Pid string) (*util.Bitmap, error)

GetCPUAffinity returns the affinity of a given task id

func IsCdpAvailiable

func IsCdpAvailiable() (bool, error)

IsCdpAvailiable returns CDP feature available or not

func IsCqmAvailiable

func IsCqmAvailiable() (bool, error)

IsCqmAvailiable returns CMT feature available or not

func IsEnableCat

func IsEnableCat() bool

IsEnableCat returns if CAT is enabled or not

func IsEnableCdp

func IsEnableCdp() bool

IsEnableCdp returns if CDP is enabled or not

func IsEnableRdt

func IsEnableRdt() bool

IsEnableRdt returns if RDT is enabled or not

func IsRdtAvailiable

func IsRdtAvailiable() (bool, error)

IsRdtAvailiable returns RDT feature available or not

func SetCPUAffinity

func SetCPUAffinity(Pid string, cpus *util.Bitmap) error

SetCPUAffinity set a process/thread's CPU affinity func SetCPUAffinity(Pid string, affinity []int) error {

Types

type Process

type Process struct {
	Pid     int
	CmdLine string
}

Process struct with pid and command line

Jump to

Keyboard shortcuts

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