Skip to content

Commit 77ef35a

Browse files
committed
small update
1 parent d1cf7c8 commit 77ef35a

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

tools/systemdatascope-makeconfig

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -290,15 +290,17 @@ class StackOrLines:
290290
# "var_name": var_name,
291291
# } )
292292

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):
294294
if Format is None: Format = getf( self.fullname + "/" + name )
295+
if labelName is None: labelName = name
295296
self.lines.append( { "name": name,
296297
"g": g,
297298
"width": width,
298299
"makeLine": makeLine,
299300
"var_name": var_name,
300301
"format": Format,
301302
"scale_data": scale_data,
303+
"labelName": labelName,
302304
} )
303305

304306
def compose(self):
@@ -347,7 +349,7 @@ class StackOrLines:
347349
s += ":" + i["name"] + color + ":"
348350
if not self.SkipLegend:
349351
if len(self.lines) > 1 or self.HeadSize is not None:
350-
s += '"' + i["name"] + '\\l"'
352+
s += '"' + i["labelName"] + '\\l"'
351353
else:
352354
s += '" \\l"'
353355

@@ -643,7 +645,7 @@ if os.path.exists( "cpu" ) or os.path.exists( "cpusleep" ):
643645
s = StackOrLines( cs, "CPUfreq", "Overview " + ht,
644646
Title = "Used frequencies" + ht,
645647
Unit="%", HeadSize = 5,
646-
t = "AREA", isStack = True )
648+
t = "AREA", isStack = True, extra_command = "--lower-limit 0" )
647649

648650
srted = sorter( D + "/time_in_state-*.rrd", "^" + D + "/time_in_state-(.*).rrd", useNumericInt = True )
649651
srted.reverse()
@@ -679,7 +681,23 @@ if os.path.exists( "cpu" ) or os.path.exists( "cpusleep" ):
679681
# CPU idle
680682
if len(glob.glob("cpuidle*")) > 0:
681683
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+
683701
for D in sorter( "cpuidle*", front=["cpuidle"]):
684702
if len(glob.glob(D + "/time_in_state*.rrd")) > 0:
685703

@@ -690,12 +708,12 @@ if os.path.exists( "cpu" ) or os.path.exists( "cpusleep" ):
690708
s = StackOrLines( cs, "CPUidle", "Overview " + ht,
691709
Title = "Used idle states" + ht,
692710
Unit="%", HeadSize = 5,
693-
t = "AREA", isStack = True )
711+
t = "AREA", isStack = True, extra_command = "--lower-limit 0" )
694712

695713
srted = sorter( D + "/time_in_state-*.rrd", "^" + D + "/time_in_state-(.*).rrd" )
696714
for g in srted:
697715
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] + "]" )
699717

700718
gt, plot, fullname = s.compose()
701719
Config["types"][fullname] = gt

0 commit comments

Comments
 (0)