Hi Jiri, On Sat, 8 Sep 2012 05:50:59 -0700, Arnaldo Carvalho de Melo wrote: > Em Sat, Sep 08, 2012 at 02:35:14PM +0200, Jiri Olsa escreveu: >> On Fri, Sep 07, 2012 at 11:55:02AM +0900, Namhyung Kim wrote: >> > Hi, Jiri >> > >> > On Thu, 6 Sep 2012 17:46:59 +0200, Jiri Olsa wrote: >> > > Currently for any of the data columns (like Overhead/Period..) in >> > > stdio ui, there's separate code to print header/dots/value scattered >> > > along the display code path. >> > > >> > > Adding hists_stdio_column struct to centralize all info needed >> > > to print column header/dots/value. >> > > >> > > This change eases up addition for new columns, which is now mostly >> > > matter only of adding new hists_stdio_column struct. >> > >> > As you may know, I submitted a similar patchset few days ago for the >> > same reason and it handles TUI/GTK cases as well. I'm waiting for >> > reviews. >> >> ok, I'll rebase this to acme/tmp.perf/hpp > > well, you can, but that one is buggy and you will not be able to test > 'perf diff' at all...
I posted the fix right before, and you will also need patch below for fixing broken "baseline" output. >From 8f2d9010979e244c6565f3a9134e7bfa61936e38 Mon Sep 17 00:00:00 2001 From: Namhyung Kim <[email protected]> Date: Sat, 8 Sep 2012 23:28:59 +0900 Subject: [PATCH] perf hist: Fix perf diff baseline output When perf diff is running, the overhead field should print old hist entry's period as a baseline. Signed-off-by: Namhyung Kim <[email protected]> --- tools/perf/ui/hist.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 16dc486d02be..326f4e9e6911 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c @@ -21,6 +21,18 @@ static int hpp__width_overhead(struct perf_hpp *hpp __used) static int hpp__color_overhead(struct perf_hpp *hpp, struct hist_entry *he) { double percent = 100.0 * he->period / hpp->total_period; + + if (hpp->ptr) { + struct hists *old_hists = hpp->ptr; + u64 total_period = old_hists->stats.total_period; + u64 base_period = he->pair ? he->pair->period : 0; + + if (total_period) + percent = 100.0 * base_period / total_period; + else + percent = 0.0; + } + return percent_color_snprintf(hpp->buf, hpp->size, " %5.2f%%", percent); } @@ -29,6 +41,17 @@ static int hpp__entry_overhead(struct perf_hpp *hpp, struct hist_entry *he) double percent = 100.0 * he->period / hpp->total_period; const char *fmt = symbol_conf.field_sep ? "%.2f" : " %5.2f%%"; + if (hpp->ptr) { + struct hists *old_hists = hpp->ptr; + u64 total_period = old_hists->stats.total_period; + u64 base_period = he->pair ? he->pair->period : 0; + + if (total_period) + percent = 100.0 * base_period / total_period; + else + percent = 0.0; + } + return scnprintf(hpp->buf, hpp->size, fmt, percent); } -- 1.7.9.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/

