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.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index be5939418425..e7417fe97a97 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -51,6 +51,7 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
51 struct addr_location *al, 51 struct addr_location *al,
52 struct perf_annotate *ann) 52 struct perf_annotate *ann)
53{ 53{
54 struct hists *hists = evsel__hists(evsel);
54 struct hist_entry *he; 55 struct hist_entry *he;
55 int ret; 56 int ret;
56 57
@@ -66,13 +67,12 @@ static int perf_evsel__add_sample(struct perf_evsel *evsel,
66 return 0; 67 return 0;
67 } 68 }
68 69
69 he = __hists__add_entry(&evsel->hists, al, NULL, NULL, NULL, 1, 1, 0, 70 he = __hists__add_entry(hists, al, NULL, NULL, NULL, 1, 1, 0, true);
70 true);
71 if (he == NULL) 71 if (he == NULL)
72 return -ENOMEM; 72 return -ENOMEM;
73 73
74 ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); 74 ret = hist_entry__inc_addr_samples(he, evsel->idx, al->addr);
75 hists__inc_nr_samples(&evsel->hists, true); 75 hists__inc_nr_samples(hists, true);
76 return ret; 76 return ret;
77} 77}
78 78
@@ -214,6 +214,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
214 214
215 if (dump_trace) { 215 if (dump_trace) {
216 perf_session__fprintf_nr_events(session, stdout); 216 perf_session__fprintf_nr_events(session, stdout);
217 perf_evlist__fprintf_nr_events(session->evlist, stdout);
217 goto out; 218 goto out;
218 } 219 }
219 220
@@ -225,7 +226,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
225 226
226 total_nr_samples = 0; 227 total_nr_samples = 0;
227 evlist__for_each(session->evlist, pos) { 228 evlist__for_each(session->evlist, pos) {
228 struct hists *hists = &pos->hists; 229 struct hists *hists = evsel__hists(pos);
229 u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 230 u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
230 231
231 if (nr_samples > 0) { 232 if (nr_samples > 0) {
@@ -325,7 +326,10 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
325 "Show event group information together"), 326 "Show event group information together"),
326 OPT_END() 327 OPT_END()
327 }; 328 };
328 int ret; 329 int ret = hists__init();
330
331 if (ret < 0)
332 return ret;
329 333
330 argc = parse_options(argc, argv, options, annotate_usage, 0); 334 argc = parse_options(argc, argv, options, annotate_usage, 0);
331 335