* [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
* Re: [PATCH] scripts/bloat-o-meter: fix percent on <1% changes
2016-06-15 8:45 [PATCH] scripts/bloat-o-meter: fix percent on <1% changes Riku Voipio
@ 2016-06-15 14:31 ` Josh Triplett
0 siblings, 0 replies; 2+ messages in thread
From: Josh Triplett @ 2016-06-15 14:31 UTC (permalink / raw)
To: Riku Voipio; +Cc: linux-kernel, Andrew Morton, Vineet Gupta, Michal Marek
On Wed, Jun 15, 2016 at 11:45:11AM +0300, Riku Voipio wrote:
> 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>
Good idea.
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
> ---
> 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 [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).