@@ -237,16 +237,20 @@ func init() {
237237 }
238238 }
239239
240- if flagsSet .MBMTotal || flagsSet .MBMLocal {
241- if _ , err := os .Stat (filepath .Join (intelRdtRoot , "info" , "L3_MON" )); err == nil {
242- mbmEnabled = true
243- cmtEnabled = true
240+ if flagsSet .MBMTotal || flagsSet .MBMLocal || flagsSet .CMT {
241+ if _ , err := os .Stat (filepath .Join (intelRdtRoot , "info" , "L3_MON" )); err != nil {
242+ return
244243 }
245-
246244 enabledMonFeatures , err = getMonFeatures (intelRdtRoot )
247245 if err != nil {
248246 return
249247 }
248+ if enabledMonFeatures .mbmTotalBytes || enabledMonFeatures .mbmLocalBytes {
249+ mbmEnabled = true
250+ }
251+ if enabledMonFeatures .llcOccupancy {
252+ cmtEnabled = true
253+ }
250254 }
251255}
252256
@@ -313,6 +317,8 @@ type cpuInfoFlags struct {
313317 // Memory Bandwidth Monitoring related.
314318 MBMTotal bool
315319 MBMLocal bool
320+
321+ CMT bool // Cache Monitoring Technology
316322}
317323
318324func parseCpuInfoFile (path string ) (cpuInfoFlags , error ) {
@@ -342,6 +348,8 @@ func parseCpuInfoFile(path string) (cpuInfoFlags, error) {
342348 infoFlags .MBMTotal = true
343349 case "cqm_mbm_local" :
344350 infoFlags .MBMLocal = true
351+ case "cqm_occup_llc" :
352+ infoFlags .CMT = true
345353 }
346354 }
347355 return infoFlags , nil
@@ -659,9 +667,11 @@ func (m *intelRdtManager) GetStats() (*Stats, error) {
659667 }
660668 }
661669
662- err = getMonitoringStats (containerPath , stats )
663- if err != nil {
664- return nil , err
670+ if IsMBMEnabled () || IsCMTEnabled () {
671+ err = getMonitoringStats (containerPath , stats )
672+ if err != nil {
673+ return nil , err
674+ }
665675 }
666676
667677 return stats , nil
0 commit comments