Documentation
¶
Index ¶
- Constants
- Variables
- func GetCPUAffinity(Pid string) (*util.Bitmap, error)
- func GetMbaMbpsMode() bool
- func Init() error
- func IsCdpAvailable() (bool, error)
- func IsCqmAvailable() (bool, error)
- func IsEnableCat() bool
- func IsEnableCdp() bool
- func IsEnableRdt() bool
- func IsRdtAvailable() (bool, error)
- func IsResctrlMounted(flag string) bool
- func SetCPUAffinity(Pid string, cpus *util.Bitmap) error
- func SetMbaMbpsMode(flag bool)
- type Process
Constants ¶
const ( // CPUInfoPath is the patch to cpuinfo CPUInfoPath = "/proc/cpuinfo" // MountInfoPath is the mount info path MountInfoPath = "/proc/self/mountinfo" //Mounts to check the resctrl is mounted in the same path Mounts = "/proc/self/mounts" )
Variables ¶
var ( // ResctrlPath is the patch to resctrl ResctrlPath string // MbaInfoPath is the MBA path of MbaInfoPath string )
var IsEnableMba = func() (bool, error) { _, err := findMountDir(ResctrlPath) if err != nil { return false, err } if stat, err := os.Stat(MbaInfoPath); err == nil { if stat.IsDir() { return true, nil } return false, nil } return false, err }
IsEnableMba returns if MBA is enabled or not
var IsL3CatAvailable = func() (bool, error) {
return parseCPUInfoFile("cat_l3")
}
IsL3CatAvailable returns L3 CAT feature available or not
var IsMbaAvailable = func() (bool, error) {
return parseCPUInfoFile("mba")
}
IsMbaAvailable returns MBA feature available or not
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 ¶
GetCPUAffinity returns the affinity of a given task id
func GetMbaMbpsMode ¶
func GetMbaMbpsMode() bool
GetMbaMbpsMode returns MBA mode currently supported by rmd
func IsCdpAvailable ¶
IsCdpAvailable returns CDP feature available or not
func IsCqmAvailable ¶
IsCqmAvailable returns CMT feature available or not
func IsRdtAvailable ¶
IsRdtAvailable returns RDT feature available or not
func IsResctrlMounted ¶
IsResctrlMounted Checks if ResCtrl is mounted and if the path is valid
func SetCPUAffinity ¶
SetCPUAffinity set a process/thread's CPU affinity func SetCPUAffinity(Pid string, affinity []int) error {
func SetMbaMbpsMode ¶
func SetMbaMbpsMode(flag bool)
SetMbaMbpsMode stores MBA mode currently supported by rmd