Messages in this thread | | | Date | Sun, 1 Dec 2013 20:56:34 +0100 | From | Jiri Olsa <> | Subject | Re: [PATCH v4 2/3] perf diff: color the Ratio column |
| |
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@redhat.com> > Cc: Arnaldo Carvalho de Melo <acme@redhat.com> > Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> > --- > 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
| |