From 77a7f6fd9ad97b282ed835dfecfc792808ffe9e5 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 24 Sep 2020 12:08:25 +0000 Subject: [PATCH] context switches: Refactor graph Signed-off-by: Michael Tremer --- src/collecty/constants.py | 7 ++++--- src/collecty/plugins/contextswitches.py | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/collecty/constants.py b/src/collecty/constants.py index 6c7a610..0d4f81c 100644 --- a/src/collecty/constants.py +++ b/src/collecty/constants.py @@ -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" diff --git a/src/collecty/plugins/contextswitches.py b/src/collecty/plugins/contextswitches.py index 821dcc8..f160609 100644 --- a/src/collecty/plugins/contextswitches.py +++ b/src/collecty/plugins/contextswitches.py @@ -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 -- 2.47.2