]> code.ossystems Code Review - openembedded-core.git/commitdiff
buildstats-summary: round the floating point percentage
authorChristopher Larson <chris_larson@mentor.com>
Fri, 1 Jul 2016 20:42:30 +0000 (13:42 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 12 Jul 2016 22:10:05 +0000 (23:10 +0100)
This was rounded in python 2, but python 3 changed the default behavior of /.
We could switch to the same behavior as previous by switching to // rather
than /, but there's value in keeping at least one decimal point, to avoid the
misleading case where it says 0% but the reuse is non-zero.

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/buildstats-summary.bbclass

index d73350b940175f3eb245656d13d773516017d010..b86abcc3f1bc67852aaa66f22431f862fff1dcd1 100644 (file)
@@ -30,7 +30,11 @@ python buildstats_summary () {
                 header_printed = True
                 bb.note("Build completion summary:")
 
-            bb.note("  {0}: {1}% sstate reuse ({2} setscene, {3} scratch)".format(t, 100*len(sstate)/(len(sstate)+len(no_sstate)), len(sstate), len(no_sstate)))
+            sstate_count = len(sstate)
+            no_sstate_count = len(no_sstate)
+            total_count = sstate_count + no_sstate_count
+            bb.note("  {0}: {1:.1f}% sstate reuse({2} setscene, {3} scratch)".format(
+                t, round(100 * sstate_count / total_count, 1), sstate_count, no_sstate_count))
 }
 addhandler buildstats_summary
 buildstats_summary[eventmask] = "bb.event.BuildCompleted"