aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/ui
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-10-05 10:44:45 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-05 13:13:36 -0400
commited279da2fc9774b4c0dc9fd513fa89a11cae3f56 (patch)
treecf7f38620d7e7ede1976b999ae613c35db959fc8 /tools/perf/ui
parent61949b212e7f6f8f31891236ba24033f9b7af8c3 (diff)
perf diff: Add -F option to display formula for computation
Adding -F option to display the formula for specified computation. This is mainly to facilitate debugging, but can be useful anyway. 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-7-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/ui')
-rw-r--r--tools/perf/ui/hist.c24
-rw-r--r--tools/perf/ui/stdio/hist.c2
2 files changed, 24 insertions, 2 deletions
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c
index 2fadaff6312f..305eb79f4af4 100644
--- a/tools/perf/ui/hist.c
+++ b/tools/perf/ui/hist.c
@@ -359,6 +359,27 @@ static int hpp__entry_displ(struct perf_hpp *hpp,
359 return scnprintf(hpp->buf, hpp->size, fmt, buf); 359 return scnprintf(hpp->buf, hpp->size, fmt, buf);
360} 360}
361 361
362static int hpp__header_formula(struct perf_hpp *hpp)
363{
364 const char *fmt = symbol_conf.field_sep ? "%s" : "%70s";
365
366 return scnprintf(hpp->buf, hpp->size, fmt, "Formula");
367}
368
369static int hpp__width_formula(struct perf_hpp *hpp __maybe_unused)
370{
371 return 70;
372}
373
374static int hpp__entry_formula(struct perf_hpp *hpp, struct hist_entry *he)
375{
376 const char *fmt = symbol_conf.field_sep ? "%s" : "%-70s";
377 char buf[96] = " ";
378
379 perf_diff__formula(buf, sizeof(buf), he);
380 return scnprintf(hpp->buf, hpp->size, fmt, buf);
381}
382
362#define HPP__COLOR_PRINT_FNS(_name) \ 383#define HPP__COLOR_PRINT_FNS(_name) \
363 .header = hpp__header_ ## _name, \ 384 .header = hpp__header_ ## _name, \
364 .width = hpp__width_ ## _name, \ 385 .width = hpp__width_ ## _name, \
@@ -383,7 +404,8 @@ struct perf_hpp_fmt perf_hpp__format[] = {
383 { .cond = false, HPP__PRINT_FNS(delta) }, 404 { .cond = false, HPP__PRINT_FNS(delta) },
384 { .cond = false, HPP__PRINT_FNS(ratio) }, 405 { .cond = false, HPP__PRINT_FNS(ratio) },
385 { .cond = false, HPP__PRINT_FNS(wdiff) }, 406 { .cond = false, HPP__PRINT_FNS(wdiff) },
386 { .cond = false, HPP__PRINT_FNS(displ) } 407 { .cond = false, HPP__PRINT_FNS(displ) },
408 { .cond = false, HPP__PRINT_FNS(formula) }
387}; 409};
388 410
389#undef HPP__COLOR_PRINT_FNS 411#undef HPP__COLOR_PRINT_FNS
diff --git a/tools/perf/ui/stdio/hist.c b/tools/perf/ui/stdio/hist.c
index fbd4e32d0743..f0ee204f99bb 100644
--- a/tools/perf/ui/stdio/hist.c
+++ b/tools/perf/ui/stdio/hist.c
@@ -342,7 +342,7 @@ size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
342 const char *sep = symbol_conf.field_sep; 342 const char *sep = symbol_conf.field_sep;
343 const char *col_width = symbol_conf.col_width_list_str; 343 const char *col_width = symbol_conf.col_width_list_str;
344 int idx, nr_rows = 0; 344 int idx, nr_rows = 0;
345 char bf[64]; 345 char bf[96];
346 struct perf_hpp dummy_hpp = { 346 struct perf_hpp dummy_hpp = {
347 .buf = bf, 347 .buf = bf,
348 .size = sizeof(bf), 348 .size = sizeof(bf),