Răsfoiți Sursa

support/scripts: sort pie charts

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>
Thomas De Schampheleire 7 ani în urmă
părinte
comite
a3f37c53d5
2 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 1 1
      support/scripts/graph-build-time
  2. 1 1
      support/scripts/size-stats

+ 1 - 1
support/scripts/graph-build-time

@@ -184,7 +184,7 @@ def pkg_pie_time_per_package(data, output):
     labels = []
     labels = []
     values = []
     values = []
     other_value = 0
     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):
         if p.get_duration() < (total * 0.01):
             other_value += p.get_duration()
             other_value += p.get_duration()
         else:
         else:

+ 1 - 1
support/scripts/size-stats

@@ -127,7 +127,7 @@ def draw_graph(pkgsize, outputf):
     labels = []
     labels = []
     values = []
     values = []
     other_value = 0
     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):
         if sz < (total * 0.01):
             other_value += sz
             other_value += sz
         else:
         else: