mbm.go 708 B

12345678910111213141516171819202122232425262728293031
  1. package intelrdt
  2. // The flag to indicate if Intel RDT/MBM is enabled
  3. var mbmEnabled bool
  4. // Check if Intel RDT/MBM is enabled.
  5. func IsMBMEnabled() bool {
  6. featuresInit()
  7. return mbmEnabled
  8. }
  9. func getMBMNumaNodeStats(numaPath string) (*MBMNumaNodeStats, error) {
  10. stats := &MBMNumaNodeStats{}
  11. if enabledMonFeatures.mbmTotalBytes {
  12. mbmTotalBytes, err := getIntelRdtParamUint(numaPath, "mbm_total_bytes")
  13. if err != nil {
  14. return nil, err
  15. }
  16. stats.MBMTotalBytes = mbmTotalBytes
  17. }
  18. if enabledMonFeatures.mbmLocalBytes {
  19. mbmLocalBytes, err := getIntelRdtParamUint(numaPath, "mbm_local_bytes")
  20. if err != nil {
  21. return nil, err
  22. }
  23. stats.MBMLocalBytes = mbmLocalBytes
  24. }
  25. return stats, nil
  26. }