don't pad with .00 histogram values when it represents a counter (only integers)
authorJulien Desfossez <jdesfossez@efficios.com>
Tue, 3 Feb 2015 20:31:18 +0000 (15:31 -0500)
committerJulien Desfossez <jdesfossez@efficios.com>
Tue, 3 Feb 2015 20:31:18 +0000 (15:31 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
ascii_graph/__init__.py
lttnganalysescli/lttnganalysescli/io.py
lttnganalysescli/lttnganalysescli/irq.py

index a6a0f713fa498120e5b1d2eb905e8c2b95d7e1e6..167c7168994b75c74b9c515b7bd4d01026f6f9e4 100644 (file)
@@ -86,8 +86,12 @@ class Pyasciigraph:
         else:
             return info + self._u(' ') * number_of_space
 
-    def _gen_value_string(self, value, start_value, start_info, unit):
-        v = str("%0.02f" % value)
+    def _gen_value_string(self, value, start_value, start_info, unit, count):
+        if not count:
+            v = str("%0.02f" % value)
+        else:
+            # we don't want to add .00 to count values (only integers)
+            v = str(value)
         number_space = start_info -\
             start_value -\
             len(v) -\
@@ -122,7 +126,7 @@ class Pyasciigraph:
         return ret
 
     def graph(self, label, data, sort=0, with_value=True, unit="",
-              info_before=False):
+              info_before=False, count=False):
         """function generating the graph
 
         :param string label: the label of the graph
@@ -201,7 +205,7 @@ class Pyasciigraph:
                 value_string = self._gen_value_string(
                     value,
                     start_value,
-                    start_info, unit)
+                    start_info, unit, count)
             else:
                 value_string = ""
 
index 76efedee9d7865417dffdb6051f63b74bd7da979..cc73165768ec053a1264add3f206e68e9f5caf1c 100644 (file)
@@ -432,7 +432,7 @@ class IoAnalysis(Command):
         for v in values:
             g.append(("%0.03f" % (i * step + _min), v))
             i += 1
-        for line in graph.graph(title, g, info_before=True):
+        for line in graph.graph(title, g, info_before=True, count=True):
             print(line)
         print("")
 
index f8e629f2ac560019a35f2b83d39bc80bdd69bec9..f4c0809b102a3776262a34f89783e0519035d5ec 100644 (file)
@@ -140,7 +140,7 @@ class IrqAnalysis(Command):
             i += 1
         for line in graph.graph('Handler duration frequency distribution %s '
                                 '(%s) (usec)' % (name, nr),
-                                g, info_before=True):
+                                g, info_before=True, count=True):
             print(line)
         print("")
 
This page took 0.027853 seconds and 5 git commands to generate.