diff options
Diffstat (limited to 'tools/perf/builtin-annotate.c')
-rw-r--r-- | tools/perf/builtin-annotate.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 7a5dc7e5c577..c38373195c4a 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -177,14 +177,11 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel, | |||
177 | */ | 177 | */ |
178 | process_branch_stack(sample->branch_stack, al, sample); | 178 | process_branch_stack(sample->branch_stack, al, sample); |
179 | 179 | ||
180 | sample->period = 1; | ||
181 | sample->weight = 1; | ||
182 | |||
183 | he = hists__add_entry(hists, al, NULL, NULL, NULL, sample, true); | 180 | he = hists__add_entry(hists, al, NULL, NULL, NULL, sample, true); |
184 | if (he == NULL) | 181 | if (he == NULL) |
185 | return -ENOMEM; | 182 | return -ENOMEM; |
186 | 183 | ||
187 | ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); | 184 | ret = hist_entry__inc_addr_samples(he, sample, evsel->idx, al->addr); |
188 | hists__inc_nr_samples(hists, true); | 185 | hists__inc_nr_samples(hists, true); |
189 | return ret; | 186 | return ret; |
190 | } | 187 | } |
@@ -397,6 +394,8 @@ int cmd_annotate(int argc, const char **argv) | |||
397 | .namespaces = perf_event__process_namespaces, | 394 | .namespaces = perf_event__process_namespaces, |
398 | .attr = perf_event__process_attr, | 395 | .attr = perf_event__process_attr, |
399 | .build_id = perf_event__process_build_id, | 396 | .build_id = perf_event__process_build_id, |
397 | .tracing_data = perf_event__process_tracing_data, | ||
398 | .feature = perf_event__process_feature, | ||
400 | .ordered_events = true, | 399 | .ordered_events = true, |
401 | .ordering_requires_timestamps = true, | 400 | .ordering_requires_timestamps = true, |
402 | }, | 401 | }, |
@@ -404,7 +403,7 @@ int cmd_annotate(int argc, const char **argv) | |||
404 | struct perf_data_file file = { | 403 | struct perf_data_file file = { |
405 | .mode = PERF_DATA_MODE_READ, | 404 | .mode = PERF_DATA_MODE_READ, |
406 | }; | 405 | }; |
407 | const struct option options[] = { | 406 | struct option options[] = { |
408 | OPT_STRING('i', "input", &input_name, "file", | 407 | OPT_STRING('i', "input", &input_name, "file", |
409 | "input file name"), | 408 | "input file name"), |
410 | OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", | 409 | OPT_STRING('d', "dsos", &symbol_conf.dso_list_str, "dso[,dso...]", |
@@ -446,13 +445,20 @@ int cmd_annotate(int argc, const char **argv) | |||
446 | "Show event group information together"), | 445 | "Show event group information together"), |
447 | OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, | 446 | OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, |
448 | "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"), | ||
449 | OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", | 450 | OPT_CALLBACK_DEFAULT(0, "stdio-color", NULL, "mode", |
450 | "'always' (default), 'never' or 'auto' only applicable to --stdio mode", | 451 | "'always' (default), 'never' or 'auto' only applicable to --stdio mode", |
451 | stdio__config_color, "always"), | 452 | stdio__config_color, "always"), |
452 | OPT_END() | 453 | OPT_END() |
453 | }; | 454 | }; |
454 | 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 | |||
455 | 460 | ||
461 | ret = hists__init(); | ||
456 | if (ret < 0) | 462 | if (ret < 0) |
457 | return ret; | 463 | return ret; |
458 | 464 | ||
@@ -468,6 +474,11 @@ int cmd_annotate(int argc, const char **argv) | |||
468 | annotate.sym_hist_filter = argv[0]; | 474 | annotate.sym_hist_filter = argv[0]; |
469 | } | 475 | } |
470 | 476 | ||
477 | if (symbol_conf.show_nr_samples && annotate.use_gtk) { | ||
478 | pr_err("--show-nr-samples is not available in --gtk mode at this time\n"); | ||
479 | return ret; | ||
480 | } | ||
481 | |||
471 | if (quiet) | 482 | if (quiet) |
472 | perf_quiet_option(); | 483 | perf_quiet_option(); |
473 | 484 | ||