support/scripts: sort pie charts
authorThomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Tue, 2 Jan 2018 14:07:23 +0000 (15:07 +0100)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 2 Jan 2018 21:40:09 +0000 (22:40 +0100)
Make sure that the pie charts produced by 'graph-build' and 'graph-size'
targets are sorted on the size of each piece of the pie. Otherwise, making
visual analysis is difficult, as one needs to look at the legends of each
piece and do the sorting manually in their head.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/scripts/graph-build-time
support/scripts/size-stats

index 0ba0f2d3a73946988b248bbaf7052935aa086fb4..9d05f2257a207bf7c622db8970c7c52973265bfd 100755 (executable)
@@ -184,7 +184,7 @@ def pkg_pie_time_per_package(data, output):
     labels = []
     values = []
     other_value = 0
-    for p in data:
+    for p in sorted(data, key=lambda p: p.get_duration()):
         if p.get_duration() < (total * 0.01):
             other_value += p.get_duration()
         else:
index 3ff2a1ce18faad223754349346ddf71b6f740e81..85e7c1596b2df67e9648b29b4633c2ce571decc6 100755 (executable)
@@ -127,7 +127,7 @@ def draw_graph(pkgsize, outputf):
     labels = []
     values = []
     other_value = 0
-    for (p, sz) in pkgsize.items():
+    for (p, sz) in sorted(pkgsize.items(), key=lambda x: x[1]):
         if sz < (total * 0.01):
             other_value += sz
         else: