]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
scripts/bloat-o-meter: fix percent on <1% changes
authorRiku Voipio <riku.voipio@linaro.org>
Tue, 26 Jul 2016 22:21:20 +0000 (15:21 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 26 Jul 2016 23:19:19 +0000 (16:19 -0700)
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%

Link: http://lkml.kernel.org/r/1465980311-23814-1-git-send-email-riku.voipio@linaro.org
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Michal Marek <mmarek@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
scripts/bloat-o-meter

index 0254f3ba0dbab0c55c2c18ccebc037c357fac1ab..19f5adfd877dcf9b7e9c5b63c796ca72ee06dccf 100755 (executable)
@@ -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))