[oe-commits] [openembedded-core] 28/31: buildstats-summary: round the floating point percentage

git at git.openembedded.org git at git.openembedded.org
Tue Jul 12 22:11:39 UTC 2016


rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 35d36a4d097ce8a0fd0be2f795e3d5052d4f753c
Author: Christopher Larson <chris_larson at mentor.com>
AuthorDate: Fri Jul 1 13:42:30 2016 -0700

    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 at mentor.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/buildstats-summary.bbclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/classes/buildstats-summary.bbclass b/meta/classes/buildstats-summary.bbclass
index d73350b..b86abcc 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"

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list