]> git.ipfire.org Git - oddments/collecty.git/commitdiff
context switches: Refactor graph
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Sep 2020 12:08:25 +0000 (12:08 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Sep 2020 12:08:25 +0000 (12:08 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/collecty/constants.py
src/collecty/plugins/contextswitches.py

index 6c7a610d4be492f3928ff851d2a80752ab61dbf7..0d4f81c67cd48aee8f13e3de0a92b0b5fb9ac369 100644 (file)
@@ -67,9 +67,10 @@ GRAPH_DEFAULT_WIDTH = 768
 GRAPH_DEFAULT_HEIGHT = 480
 
 # Default column widths
-LEGEND     = "%16s"
-LABEL      = "%-14s"
-PERCENTAGE = "%13.2lf%%"
+LEGEND     = "%18s"
+LABEL      = "%-16s"
+PERCENTAGE = "%15.2lf%%"
+INTEGER    = "%18.0lf"
 
 EMPTY_LINE = "COMMENT: \\n"
 
index 821dcc8c2632b07cd55b7c2cb5643da80ce26f12..f16060983fbccf17c8aeff2429443752e4b21545 100644 (file)
@@ -24,6 +24,7 @@ import re
 from . import base
 
 from ..colours import *
+from ..constants import *
 
 class GraphTemplateContextSwitches(base.GraphTemplate):
        name = "context-switches"
@@ -33,14 +34,21 @@ class GraphTemplateContextSwitches(base.GraphTemplate):
                _ = self.locale.translate
 
                return [
-                       "AREA:ctxt%s:%-15s" % (
+                       "COMMENT:%s" % (LEGEND % ""),
+                       "COMMENT:%s" % (LEGEND % _("Current")),
+                       "COMMENT:%s" % (LEGEND % _("Average")),
+                       "COMMENT:%s" % (LEGEND % _("Minimum")),
+                       "COMMENT:%s\\j" % (LEGEND % _("Maximum")),
+
+                       "AREA:ctxt%s:%s" % (
                                lighten(PRIMARY, AREA_OPACITY),
-                               _("Context Switches"),
+                               LABEL % _("Context Switches"),
                        ),
-                       "GPRINT:ctxt_max:%12s\:" % _("Maximum") + " %6.2lf" ,
-                       "GPRINT:ctxt_min:%12s\:" % _("Minimum") + " %6.2lf" ,
-                       "GPRINT:ctxt_avg:%12s\:" % _("Average") + " %6.2lf",
-                       "LINE1:ctxt%s" % PRIMARY,
+                       "GPRINT:ctxt_cur:%s" % INTEGER,
+                       "GPRINT:ctxt_avg:%s" % INTEGER,
+                       "GPRINT:ctxt_min:%s" % INTEGER,
+                       "GPRINT:ctxt_max:%s" % INTEGER,
+                       "LINE2:ctxt%s" % PRIMARY,
                ]
 
        lower_limit = 0