aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-annotate.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r--tools/perf/builtin-annotate.c16
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