buildstats-summary: round the floating point percentage
PATCH v2 1/1 buildstats-summary: round the floating point percentage
From: Christopher Larson <[email protected]>
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.
--- meta/classes/buildstats-summary.bbclass | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
meta/classes/buildstats-summary.bbclass +5 -1
@@ -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"
Signature · 1 line
2.8.0
Quoted 11 lines · Christopher Larson
From: Christopher Larson <[email protected]>
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 <[email protected]>
v2 changes: fixed to correctly do the rounding as part of the string formatting.
Signature · 5 lines
Christopher Larson kergoth at gmail dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics