aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui/hist.c
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-10-05 10:44:43 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-05 13:10:42 -0400
commit81d5f95819953321a2557b0656b24ea10af9629c (patch)
tree27efd993d93ab00da7fdfebe5c3563f1eba4d7f4 /tools/perf/ui/hist.c
parent96c47f19846742bdfa3c153c8d26ccca5945586b (diff)
perf diff: Add weighted diff computation way to compare hist entries
Adding 'wdiff' as new computation way to compare hist entries. If specified the 'Weighted diff' column is displayed with value 'd' computed as: d = B->period * WEIGHT-A - A->period * WEIGHT-B - A/B being matching hist entry from first/second file specified (or perf.data/perf.data.old) respectively. - period being the hist entry period value - WEIGHT-A/WEIGHT-B being user suplied weights in the the '-c' option behind ':' separator like '-c wdiff:1,2'. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1349448287-18919-5-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui/hist.c')
-rw-r--r--tools/perf/ui/hist.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 659f2a25e997..522b4ec051d5 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -286,6 +286,35 @@ static int hpp__entry_ratio(struct perf_hpp *hpp, struct hist_entry *he)
286 return scnprintf(hpp->buf, hpp->size, fmt, buf); 286 return scnprintf(hpp->buf, hpp->size, fmt, buf);
287} 287}
288 288
289static int hpp__header_wdiff(struct perf_hpp *hpp)
290{
291 const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
292
293 return scnprintf(hpp->buf, hpp->size, fmt, "Weighted diff");
294}
295
296static int hpp__width_wdiff(struct perf_hpp *hpp __maybe_unused)
297{
298 return 14;
299}
300
301static int hpp__entry_wdiff(struct perf_hpp *hpp, struct hist_entry *he)
302{
303 const char *fmt = symbol_conf.field_sep ? "%s" : "%14s";
304 char buf[32] = " ";
305 s64 wdiff;
306
307 if (he->diff.computed)
308 wdiff = he->diff.wdiff;
309 else
310 wdiff = perf_diff__compute_wdiff(he);
311
312 if (wdiff != 0)
313 scnprintf(buf, sizeof(buf), "%14ld", wdiff);
314
315 return scnprintf(hpp->buf, hpp->size, fmt, buf);
316}
317
289static int hpp__header_displ(struct perf_hpp *hpp) 318static int hpp__header_displ(struct perf_hpp *hpp)
290{ 319{
291 return scnprintf(hpp->buf, hpp->size, "Displ."); 320 return scnprintf(hpp->buf, hpp->size, "Displ.");
@@ -332,6 +361,7 @@ struct perf_hpp_fmt perf_hpp__format[] = {
332 { .cond = false, HPP__PRINT_FNS(period) }, 361 { .cond = false, HPP__PRINT_FNS(period) },
333 { .cond = false, HPP__PRINT_FNS(delta) }, 362 { .cond = false, HPP__PRINT_FNS(delta) },
334 { .cond = false, HPP__PRINT_FNS(ratio) }, 363 { .cond = false, HPP__PRINT_FNS(ratio) },
364 { .cond = false, HPP__PRINT_FNS(wdiff) },
335 { .cond = false, HPP__PRINT_FNS(displ) } 365 { .cond = false, HPP__PRINT_FNS(displ) }
336}; 366};
337 367