2020-04-09 05:05:35 +08:00
|
|
|
// +build linux
|
|
|
|
|
|
|
|
package intelrdt
|
|
|
|
|
|
|
|
var (
|
|
|
|
// The flag to indicate if Intel RDT/MBM is enabled
|
2020-04-16 03:18:41 +08:00
|
|
|
mbmEnabled bool
|
2020-04-09 05:05:35 +08:00
|
|
|
)
|
|
|
|
|
2020-04-16 03:18:41 +08:00
|
|
|
// Check if Intel RDT/MBM is enabled.
|
|
|
|
func IsMBMEnabled() bool {
|
|
|
|
return mbmEnabled
|
2020-04-09 05:05:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func getMBMNumaNodeStats(numaPath string) (*MBMNumaNodeStats, error) {
|
|
|
|
stats := &MBMNumaNodeStats{}
|
|
|
|
if enabledMonFeatures.mbmTotalBytes {
|
|
|
|
mbmTotalBytes, err := getIntelRdtParamUint(numaPath, "mbm_total_bytes")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
stats.MBMTotalBytes = mbmTotalBytes
|
|
|
|
}
|
|
|
|
|
|
|
|
if enabledMonFeatures.mbmLocalBytes {
|
|
|
|
mbmLocalBytes, err := getIntelRdtParamUint(numaPath, "mbm_local_bytes")
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
stats.MBMLocalBytes = mbmLocalBytes
|
|
|
|
}
|
|
|
|
|
|
|
|
return stats, nil
|
|
|
|
}
|