summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-07-01 13:42:30 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-12 23:10:05 +0100
commit35d36a4d097ce8a0fd0be2f795e3d5052d4f753c (patch)
tree295734856ef0637161af06d16b1ee31b6f7d4a88
parent7f4d7a6f51569954e204f110827a8ce256bcdc68 (diff)
downloadopenembedded-core-contrib-35d36a4d097ce8a0fd0be2f795e3d5052d4f753c.tar.gz
openembedded-core-contrib-35d36a4d097ce8a0fd0be2f795e3d5052d4f753c.tar.bz2
openembedded-core-contrib-35d36a4d097ce8a0fd0be2f795e3d5052d4f753c.zip
buildstats-summary: round the floating point percentage
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>
-rw-r--r--meta/classes/buildstats-summary.bbclass6
1 files changed, 5 insertions, 1 deletions
diff --git a/meta/classes/buildstats-summary.bbclass b/meta/classes/buildstats-summary.bbclass
index d73350b940..b86abcc3f1 100644
--- a/meta/classes/buildstats-summary.bbclass
+++ b/meta/classes/buildstats-summary.bbclass
@@ -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"