diff options
author | Taeung Song <treeze.taeung@gmail.com> | 2017-08-18 04:46:48 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-08-18 09:31:53 -0400 |
commit | 1ac39372e06f5009982aaaf890fc5bbd044bb047 (patch) | |
tree | 38059befa819af8d01667ef4733a41f117ab91ca /tools/perf/builtin-annotate.c | |
parent | 9a57eaf1d2443d34cce0562f425228c37a8ec019 (diff) |
perf annotate stdio: Support --show-nr-samples option
Add --show-nr-samples option to "perf annotate" so that it matches "perf
report".
Committer note:
Note that it can't be used together with --show-total-period, which
seems like a silly limitation, that can be lifted at some point.
Made it bail out if not on --stdio.
Signed-off-by: Taeung Song <treeze.taeung@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/r/1503046008-5511-1-git-send-email-treeze.taeung@gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 658c920d74b9..89fc0389dc76 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -403,7 +403,7 @@ int cmd_annotate(int argc, const char **argv) | |||
403 | struct perf_data_file file = { | 403 | struct perf_data_file file = { |
404 | .mode = PERF_DATA_MODE_READ, | 404 | .mode = PERF_DATA_MODE_READ, |
405 | }; | 405 | }; |
406 | const struct option options[] = { | 406 | struct option options[] = { |
407 | OPT_STRING('i', "input", &input_name, "file", | 407 | OPT_STRING('i', "input", &input_name, "file", |
408 | "input file name"), | 408 | "input file name"), |
409 | OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", | 409 | OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", |
@@ -445,13 +445,20 @@ int cmd_annotate(int argc, const char **argv) | |||
445 | "Show event group information together"), | 445 | "Show event group information together"), |
446 | OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, | 446 | OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, |
447 | "Show a column with the sum of periods"), | 447 | "Show a column with the sum of periods"), |
448 | OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples, | ||
449 | "Show a column with the number of samples"), | ||
448 | OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", | 450 | OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", |
449 | "'always' (default), 'never' or 'auto' only applicable to --stdio mode", | 451 | "'always' (default), 'never' or 'auto' only applicable to --stdio mode", |
450 | stdio__config_color, "always"), | 452 | stdio__config_color, "always"), |
451 | OPT_END() | 453 | OPT_END() |
452 | }; | 454 | }; |
453 | int ret = hists__init(); | 455 | int ret; |
456 | |||
457 | set_option_flag(options, 0, "show-total-period", PARSE_OPT_EXCLUSIVE); | ||
458 | set_option_flag(options, 0, "show-nr-samples", PARSE_OPT_EXCLUSIVE); | ||
459 | |||
454 | 460 | ||
461 | ret = hists__init(); | ||
455 | if (ret < 0) | 462 | if (ret < 0) |
456 | return ret; | 463 | return ret; |
457 | 464 | ||
@@ -467,6 +474,11 @@ int cmd_annotate(int argc, const char **argv) | |||
467 | annotate.sym_hist_filter = argv[0]; | 474 | annotate.sym_hist_filter = argv[0]; |
468 | } | 475 | } |
469 | 476 | ||
477 | if (symbol_conf.show_nr_samples && !annotate.use_stdio) { | ||
478 | pr_err("--show-nr-samples is only available in --stdio mode at this time\n"); | ||
479 | return ret; | ||
480 | } | ||
481 | |||
470 | if (quiet) | 482 | if (quiet) |
471 | perf_quiet_option(); | 483 | perf_quiet_option(); |
472 | 484 | ||