scripts/bloat-o-meter: fix percent on <1% changes
PATCH 8/126 scripts/bloat-o-meter: fix percent on <1% changes
From: Riku Voipio <[email protected]>
Subject: scripts/bloat-o-meter: fix percent on <1% changes
Python divisions are integer divisions unless at least one parameter is a float. The current bloat-o-meter fails to print sub-percentage changes:
Total: Before=10515408, After=10604060, chg 0.000000%
Force float division by using one float and pretty the print to two significant decimals:
Total: Before=10515408, After=10604060, chg +0.84%
Signed-off-by Riku Voipio <[email protected]>
Reviewed-by Josh Triplett <[email protected]>
Cc Vineet Gupta <[email protected]>
Cc Michal Marek <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
scripts/bloat-o-meter | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/bloat-o-meter renamed from scripts/bloat-o-meter~scripts-bloat-o-meter-fix-percent-on-1%-changes +2 -2
@@ -67,5 +67,5 @@ print("%-40s %7s %7s %+7s" % ("function" for d, n in delta: if d: print("%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)) -print("Total: Before=%d, After=%d, chg %f%%" % \ - (otot, ntot, (ntot - otot)*100/otot)) +print("Total: Before=%d, After=%d, chg %+.2f%%" % \ + (otot, ntot, (ntot - otot)*100.0/otot))
_