diff options
author | Jiri Olsa <jolsa@redhat.com> | 2012-10-05 10:44:44 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-05 13:11:47 -0400 |
commit | 61949b212e7f6f8f31891236ba24033f9b7af8c3 (patch) | |
tree | d31f37b0360e2b9bef0ccde43b1f0139ef0232e8 /tools | |
parent | 81d5f95819953321a2557b0656b24ea10af9629c (diff) |
perf diff: Add -p option to display period values for hist entries
Adding -p option to show period values for both compared hist entries.
Showing hist column PERF_HPP__PERIOD and newly added hist column
PERF_HPP__PERIOD_BASELINE.
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-6-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/Documentation/perf-diff.txt | 4 | ||||
-rw-r--r-- | tools/perf/builtin-diff.c | 10 | ||||
-rw-r--r-- | tools/perf/ui/hist.c | 21 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 1 |
4 files changed, 35 insertions, 1 deletions
diff --git a/tools/perf/Documentation/perf-diff.txt b/tools/perf/Documentation/perf-diff.txt index fa413ac914f5..21cc2ef7756b 100644 --- a/tools/perf/Documentation/perf-diff.txt +++ b/tools/perf/Documentation/perf-diff.txt | |||
@@ -83,6 +83,10 @@ OPTIONS | |||
83 | on the computation results. | 83 | on the computation results. |
84 | See COMPARISON METHODS section for more info. | 84 | See COMPARISON METHODS section for more info. |
85 | 85 | ||
86 | -p:: | ||
87 | --period:: | ||
88 | Show period values for both compared hist entries. | ||
89 | |||
86 | COMPARISON METHODS | 90 | COMPARISON METHODS |
87 | ------------------ | 91 | ------------------ |
88 | delta | 92 | delta |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index d78e8386e1a9..2411dd18c556 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -24,6 +24,7 @@ static char const *input_old = "perf.data.old", | |||
24 | static char diff__default_sort_order[] = "dso,symbol"; | 24 | static char diff__default_sort_order[] = "dso,symbol"; |
25 | static bool force; | 25 | static bool force; |
26 | static bool show_displacement; | 26 | static bool show_displacement; |
27 | static bool show_period; | ||
27 | static bool show_baseline_only; | 28 | static bool show_baseline_only; |
28 | static bool sort_compute; | 29 | static bool sort_compute; |
29 | 30 | ||
@@ -540,6 +541,8 @@ static const struct option options[] = { | |||
540 | "delta,ratio,wdiff:w1,w2 (default delta)", | 541 | "delta,ratio,wdiff:w1,w2 (default delta)", |
541 | "Entries differential computation selection", | 542 | "Entries differential computation selection", |
542 | setup_compute), | 543 | setup_compute), |
544 | OPT_BOOLEAN('p', "period", &show_period, | ||
545 | "Show period values."), | ||
543 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 546 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
544 | "dump raw trace in ASCII"), | 547 | "dump raw trace in ASCII"), |
545 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | 548 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), |
@@ -568,7 +571,7 @@ static void ui_init(void) | |||
568 | /* No overhead column. */ | 571 | /* No overhead column. */ |
569 | perf_hpp__column_enable(PERF_HPP__OVERHEAD, false); | 572 | perf_hpp__column_enable(PERF_HPP__OVERHEAD, false); |
570 | 573 | ||
571 | /* Display baseline/delta/ratio/displacement columns. */ | 574 | /* Display baseline/delta/ratio/displacement/periods columns. */ |
572 | perf_hpp__column_enable(PERF_HPP__BASELINE, true); | 575 | perf_hpp__column_enable(PERF_HPP__BASELINE, true); |
573 | 576 | ||
574 | switch (compute) { | 577 | switch (compute) { |
@@ -587,6 +590,11 @@ static void ui_init(void) | |||
587 | 590 | ||
588 | if (show_displacement) | 591 | if (show_displacement) |
589 | perf_hpp__column_enable(PERF_HPP__DISPL, true); | 592 | perf_hpp__column_enable(PERF_HPP__DISPL, true); |
593 | |||
594 | if (show_period) { | ||
595 | perf_hpp__column_enable(PERF_HPP__PERIOD, true); | ||
596 | perf_hpp__column_enable(PERF_HPP__PERIOD_BASELINE, true); | ||
597 | } | ||
590 | } | 598 | } |
591 | 599 | ||
592 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) | 600 | int cmd_diff(int argc, const char **argv, const char *prefix __maybe_unused) |
diff --git a/tools/perf/ui/hist.c b/tools/perf/ui/hist.c index 522b4ec051d5..2fadaff6312f 100644 --- a/tools/perf/ui/hist.c +++ b/tools/perf/ui/hist.c | |||
@@ -228,6 +228,26 @@ static int hpp__entry_period(struct perf_hpp *hpp, struct hist_entry *he) | |||
228 | return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period); | 228 | return scnprintf(hpp->buf, hpp->size, fmt, he->stat.period); |
229 | } | 229 | } |
230 | 230 | ||
231 | static int hpp__header_period_baseline(struct perf_hpp *hpp) | ||
232 | { | ||
233 | const char *fmt = symbol_conf.field_sep ? "%s" : "%12s"; | ||
234 | |||
235 | return scnprintf(hpp->buf, hpp->size, fmt, "Period Base"); | ||
236 | } | ||
237 | |||
238 | static int hpp__width_period_baseline(struct perf_hpp *hpp __maybe_unused) | ||
239 | { | ||
240 | return 12; | ||
241 | } | ||
242 | |||
243 | static int hpp__entry_period_baseline(struct perf_hpp *hpp, struct hist_entry *he) | ||
244 | { | ||
245 | struct hist_entry *pair = he->pair; | ||
246 | u64 period = pair ? pair->stat.period : 0; | ||
247 | const char *fmt = symbol_conf.field_sep ? "%" PRIu64 : "%12" PRIu64; | ||
248 | |||
249 | return scnprintf(hpp->buf, hpp->size, fmt, period); | ||
250 | } | ||
231 | static int hpp__header_delta(struct perf_hpp *hpp) | 251 | static int hpp__header_delta(struct perf_hpp *hpp) |
232 | { | 252 | { |
233 | const char *fmt = symbol_conf.field_sep ? "%s" : "%7s"; | 253 | const char *fmt = symbol_conf.field_sep ? "%s" : "%7s"; |
@@ -359,6 +379,7 @@ struct perf_hpp_fmt perf_hpp__format[] = { | |||
359 | { .cond = false, HPP__COLOR_PRINT_FNS(overhead_guest_us) }, | 379 | { .cond = false, HPP__COLOR_PRINT_FNS(overhead_guest_us) }, |
360 | { .cond = false, HPP__PRINT_FNS(samples) }, | 380 | { .cond = false, HPP__PRINT_FNS(samples) }, |
361 | { .cond = false, HPP__PRINT_FNS(period) }, | 381 | { .cond = false, HPP__PRINT_FNS(period) }, |
382 | { .cond = false, HPP__PRINT_FNS(period_baseline) }, | ||
362 | { .cond = false, HPP__PRINT_FNS(delta) }, | 383 | { .cond = false, HPP__PRINT_FNS(delta) }, |
363 | { .cond = false, HPP__PRINT_FNS(ratio) }, | 384 | { .cond = false, HPP__PRINT_FNS(ratio) }, |
364 | { .cond = false, HPP__PRINT_FNS(wdiff) }, | 385 | { .cond = false, HPP__PRINT_FNS(wdiff) }, |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index ce76f36aeb0a..5604791e5ede 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -140,6 +140,7 @@ enum { | |||
140 | PERF_HPP__OVERHEAD_GUEST_US, | 140 | PERF_HPP__OVERHEAD_GUEST_US, |
141 | PERF_HPP__SAMPLES, | 141 | PERF_HPP__SAMPLES, |
142 | PERF_HPP__PERIOD, | 142 | PERF_HPP__PERIOD, |
143 | PERF_HPP__PERIOD_BASELINE, | ||
143 | PERF_HPP__DELTA, | 144 | PERF_HPP__DELTA, |
144 | PERF_HPP__RATIO, | 145 | PERF_HPP__RATIO, |
145 | PERF_HPP__WEIGHTED_DIFF, | 146 | PERF_HPP__WEIGHTED_DIFF, |