linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/bloat-o-meter: fix percent on <1% changes
@ 2016-06-15  8:45 Riku Voipio
  2016-06-15 14:31 ` Josh Triplett
  0 siblings, 1 reply; 2+ messages in thread
From: Riku Voipio @ 2016-06-15  8:45 UTC (permalink / raw)
  To: linux-kernel, Andrew Morton
  Cc: Riku Voipio, Vineet Gupta, Josh Triplett, Michal Marek

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 <riku.voipio@linaro.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Michal Marek <mmarek@suse.cz>
---
 scripts/bloat-o-meter | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/bloat-o-meter b/scripts/bloat-o-meter
index 0254f3b..19f5adf 100755
--- a/scripts/bloat-o-meter
+++ b/scripts/bloat-o-meter
@@ -67,5 +67,5 @@ print("%-40s %7s %7s %+7s" % ("function", "old", "new", "delta"))
 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))
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-15 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15  8:45 [PATCH] scripts/bloat-o-meter: fix percent on <1% changes Riku Voipio
2016-06-15 14:31 ` Josh Triplett

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).