@@ -290,15 +290,17 @@ class StackOrLines:
290
290
# "var_name": var_name,
291
291
# } )
292
292
293
- def add (self , name , g , width = "$LINE_WIDTH_PRIMARY$" , makeLine = False , var_name = "value" , Format = None , scale_data = None ):
293
+ def add (self , name , g , width = "$LINE_WIDTH_PRIMARY$" , makeLine = False , var_name = "value" , labelName = None , Format = None , scale_data = None ):
294
294
if Format is None : Format = getf ( self .fullname + "/" + name )
295
+ if labelName is None : labelName = name
295
296
self .lines .append ( { "name" : name ,
296
297
"g" : g ,
297
298
"width" : width ,
298
299
"makeLine" : makeLine ,
299
300
"var_name" : var_name ,
300
301
"format" : Format ,
301
302
"scale_data" : scale_data ,
303
+ "labelName" : labelName ,
302
304
} )
303
305
304
306
def compose (self ):
@@ -347,7 +349,7 @@ class StackOrLines:
347
349
s += ":" + i ["name" ] + color + ":"
348
350
if not self .SkipLegend :
349
351
if len (self .lines ) > 1 or self .HeadSize is not None :
350
- s += '"' + i ["name " ] + '\\ l"'
352
+ s += '"' + i ["labelName " ] + '\\ l"'
351
353
else :
352
354
s += '" \\ l"'
353
355
@@ -643,7 +645,7 @@ if os.path.exists( "cpu" ) or os.path.exists( "cpusleep" ):
643
645
s = StackOrLines ( cs , "CPUfreq" , "Overview " + ht ,
644
646
Title = "Used frequencies" + ht ,
645
647
Unit = "%" , HeadSize = 5 ,
646
- t = "AREA" , isStack = True )
648
+ t = "AREA" , isStack = True , extra_command = "--lower-limit 0" )
647
649
648
650
srted = sorter ( D + "/time_in_state-*.rrd" , "^" + D + "/time_in_state-(.*).rrd" , useNumericInt = True )
649
651
srted .reverse ()
@@ -679,7 +681,23 @@ if os.path.exists( "cpu" ) or os.path.exists( "cpusleep" ):
679
681
# CPU idle
680
682
if len (glob .glob ("cpuidle*" )) > 0 :
681
683
SubPlots = { "subplots" : { "title" : "CPU idle states details" , "plots" : [ ] } }
682
-
684
+
685
+ # # make local dictionary
686
+ # idleName2Desc = {}
687
+ # for d in glob.glob("/sys/devices/system/cpu/cpu*/cpuidle/state*"):
688
+ # f = open(d + "/name", "r")
689
+ # name = f.readline()
690
+ # name = name.strip()
691
+ # for c in [" ", "-", "/"]: name = name.replace(c, "_")
692
+ # f.close()
693
+
694
+ # f = open(d + "/desc", "r")
695
+ # desc = f.readline()
696
+ # desc = desc.strip()
697
+ # f.close()
698
+
699
+ # idleName2Desc[name] = desc
700
+
683
701
for D in sorter ( "cpuidle*" , front = ["cpuidle" ]):
684
702
if len (glob .glob (D + "/time_in_state*.rrd" )) > 0 :
685
703
@@ -690,12 +708,12 @@ if os.path.exists( "cpu" ) or os.path.exists( "cpusleep" ):
690
708
s = StackOrLines ( cs , "CPUidle" , "Overview " + ht ,
691
709
Title = "Used idle states" + ht ,
692
710
Unit = "%" , HeadSize = 5 ,
693
- t = "AREA" , isStack = True )
711
+ t = "AREA" , isStack = True , extra_command = "--lower-limit 0" )
694
712
695
713
srted = sorter ( D + "/time_in_state-*.rrd" , "^" + D + "/time_in_state-(.*).rrd" )
696
714
for g in srted :
697
715
name = re .search ( "^" + D + "/time_in_state-(.*).rrd" , g ).group (1 )
698
- s .add ( name , g , scale_data = "100,*" , Format = "%4.0lf%s" )
716
+ s .add ( name , g , scale_data = "100,*" , Format = "%4.0lf%s" ) #, labelName = name + "[" + idleName2Desc[name] + "] " )
699
717
700
718
gt , plot , fullname = s .compose ()
701
719
Config ["types" ][fullname ] = gt
0 commit comments