Re: [PATCH v4 2/3] perf diff: color the Ratio column

From: Jiri Olsa
Date: Sun Dec 01 2013 - 14:57:03 EST


On Fri, Nov 29, 2013 at 07:06:31PM +0530, Ramkumar Ramachandra wrote:
> In
>
> $ perf diff -c ratio
>
> color the Ratio column using percent_color_snprintf().
>
> Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> Signed-off-by: Ramkumar Ramachandra <artagnon@xxxxxxxxx>
> ---
> tools/perf/builtin-diff.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
> index c970aae..25dac6c 100644
> --- a/tools/perf/builtin-diff.c
> +++ b/tools/perf/builtin-diff.c
> @@ -794,6 +794,17 @@ static int __hpp__color_compare(struct perf_hpp_fmt *fmt,
> scnprintf(pfmt, 20, "%%%+d.2f%%%%", dfmt->header_width - 1);
> return percent_color_snprintf(hpp->buf, hpp->size,
> pfmt, fabs(diff));
> + case COMPUTE_RATIO:
> + if (he->dummy)
> + goto dummy_print;
> + if (pair->diff.computed)
> + diff = pair->diff.period_ratio;
> + else
> + diff = compute_ratio(he, pair);
> +
> + scnprintf(pfmt, 20, "%%%d.6f", dfmt->header_width);
> + return percent_color_snprintf(hpp->buf, hpp->size,
> + pfmt, diff);

ok, lets keep same limits for ratio and wdiff.. unless
we hear otherwise ;-)

Arnaldo,
I think we want to add something like 'value_color_snprintf' ?
to keep percent/values separated..

It'd do the same job, just the name does not fit in here,
because we are printing out ratio values.

thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/