aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2014-10-09 12:13:41 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-10-09 12:13:41 -0400
commit4ea062ed431d00153af0ac370cb6fef0620e5fa1 (patch)
treec4e7ad89b37d57751802524212291d1a8a89b7e3 /tools/perf
parent49c23f2d541ebf7ae5e9fff03301f4e7145cc979 (diff)
perf evsel: Add hists helper
Not all tools need a hists instance per perf_evsel, so lets pave the way to remove evsel->hists while leaving a way to access the hists from a specially allocated evsel, one that comes with space at the end where lives the evsel. Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Borislav Petkov <bp@suse.de> Cc: David Ahern <dsahern@gmail.com> Cc: Don Zickus <dzickus@redhat.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jean Pihet <jean.pihet@linaro.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/n/tip-qlktkhe31w4mgtbd84035sr2@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-annotate.c8
-rw-r--r--tools/perf/builtin-diff.c21
-rw-r--r--tools/perf/builtin-report.c18
-rw-r--r--tools/perf/builtin-top.c55
-rw-r--r--tools/perf/tests/hists_cumulate.c8
-rw-r--r--tools/perf/tests/hists_filter.c23
-rw-r--r--tools/perf/tests/hists_link.c23
-rw-r--r--tools/perf/tests/hists_output.c20
-rw-r--r--tools/perf/ui/browsers/hists.c20
-rw-r--r--tools/perf/ui/gtk/hists.c2
-rw-r--r--tools/perf/util/evsel.h5
-rw-r--r--tools/perf/util/hist.c22
-rw-r--r--tools/perf/util/session.c4
-rw-r--r--tools/perf/util/sort.c4
14 files changed, 132 insertions, 101 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index be5939418425..c9a119e2113d 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
@@ -225,7 +225,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
225 225
226 total_nr_samples = 0; 226 total_nr_samples = 0;
227 evlist__for_each(session->evlist, pos) { 227 evlist__for_each(session->evlist, pos) {
228 struct hists *hists = &pos->hists; 228 struct hists *hists = evsel__hists(pos);
229 u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; 229 u32 nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE];
230 230
231 if (nr_samples > 0) { 231 if (nr_samples > 0) {
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c
index a3ce19f7aebd..8c5c11ca8c53 100644
--- a/tools/perf/builtin-diff.c
+++ b/tools/perf/builtin-diff.c
@@ -327,6 +327,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
327 struct machine *machine) 327 struct machine *machine)
328{ 328{
329 struct addr_location al; 329 struct addr_location al;
330 struct hists *hists = evsel__hists(evsel);
330 331
331 if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { 332 if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) {
332 pr_warning("problem processing %d event, skipping it.\n", 333 pr_warning("problem processing %d event, skipping it.\n",
@@ -334,7 +335,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
334 return -1; 335 return -1;
335 } 336 }
336 337
337 if (hists__add_entry(&evsel->hists, &al, sample->period, 338 if (hists__add_entry(hists, &al, sample->period,
338 sample->weight, sample->transaction)) { 339 sample->weight, sample->transaction)) {
339 pr_warning("problem incrementing symbol period, skipping event\n"); 340 pr_warning("problem incrementing symbol period, skipping event\n");
340 return -1; 341 return -1;
@@ -346,9 +347,9 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,
346 * hists__output_resort() and precompute needs the total 347 * hists__output_resort() and precompute needs the total
347 * period in order to sort entries by percentage delta. 348 * period in order to sort entries by percentage delta.
348 */ 349 */
349 evsel->hists.stats.total_period += sample->period; 350 hists->stats.total_period += sample->period;
350 if (!al.filtered) 351 if (!al.filtered)
351 evsel->hists.stats.total_non_filtered_period += sample->period; 352 hists->stats.total_non_filtered_period += sample->period;
352 353
353 return 0; 354 return 0;
354} 355}
@@ -382,7 +383,7 @@ static void perf_evlist__collapse_resort(struct perf_evlist *evlist)
382 struct perf_evsel *evsel; 383 struct perf_evsel *evsel;
383 384
384 evlist__for_each(evlist, evsel) { 385 evlist__for_each(evlist, evsel) {
385 struct hists *hists = &evsel->hists; 386 struct hists *hists = evsel__hists(evsel);
386 387
387 hists__collapse_resort(hists, NULL); 388 hists__collapse_resort(hists, NULL);
388 } 389 }
@@ -631,24 +632,26 @@ static void data_process(void)
631 bool first = true; 632 bool first = true;
632 633
633 evlist__for_each(evlist_base, evsel_base) { 634 evlist__for_each(evlist_base, evsel_base) {
635 struct hists *hists_base = evsel__hists(evsel_base);
634 struct data__file *d; 636 struct data__file *d;
635 int i; 637 int i;
636 638
637 data__for_each_file_new(i, d) { 639 data__for_each_file_new(i, d) {
638 struct perf_evlist *evlist = d->session->evlist; 640 struct perf_evlist *evlist = d->session->evlist;
639 struct perf_evsel *evsel; 641 struct perf_evsel *evsel;
642 struct hists *hists;
640 643
641 evsel = evsel_match(evsel_base, evlist); 644 evsel = evsel_match(evsel_base, evlist);
642 if (!evsel) 645 if (!evsel)
643 continue; 646 continue;
644 647
645 d->hists = &evsel->hists; 648 hists = evsel__hists(evsel);
649 d->hists = hists;
646 650
647 hists__match(&evsel_base->hists, &evsel->hists); 651 hists__match(hists_base, hists);
648 652
649 if (!show_baseline_only) 653 if (!show_baseline_only)
650 hists__link(&evsel_base->hists, 654 hists__link(hists_base, hists);
651 &evsel->hists);
652 } 655 }
653 656
654 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n", 657 fprintf(stdout, "%s# Event '%s'\n#\n", first ? "" : "\n",
@@ -659,7 +662,7 @@ static void data_process(void)
659 if (verbose || data__files_cnt > 2) 662 if (verbose || data__files_cnt > 2)
660 data__fprintf(); 663 data__fprintf();
661 664
662 hists__process(&evsel_base->hists); 665 hists__process(hists_base);
663 } 666 }
664} 667}
665 668
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index ac145fae0521..3750d635f0f7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -288,12 +288,14 @@ static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report
288 evname = buf; 288 evname = buf;
289 289
290 for_each_group_member(pos, evsel) { 290 for_each_group_member(pos, evsel) {
291 const struct hists *pos_hists = evsel__hists(pos);
292
291 if (symbol_conf.filter_relative) { 293 if (symbol_conf.filter_relative) {
292 nr_samples += pos->hists.stats.nr_non_filtered_samples; 294 nr_samples += pos_hists->stats.nr_non_filtered_samples;
293 nr_events += pos->hists.stats.total_non_filtered_period; 295 nr_events += pos_hists->stats.total_non_filtered_period;
294 } else { 296 } else {
295 nr_samples += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 297 nr_samples += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE];
296 nr_events += pos->hists.stats.total_period; 298 nr_events += pos_hists->stats.total_period;
297 } 299 }
298 } 300 }
299 } 301 }
@@ -318,7 +320,7 @@ static int perf_evlist__tty_browse_hists(struct perf_evlist *evlist,
318 struct perf_evsel *pos; 320 struct perf_evsel *pos;
319 321
320 evlist__for_each(evlist, pos) { 322 evlist__for_each(evlist, pos) {
321 struct hists *hists = &pos->hists; 323 struct hists *hists = evsel__hists(pos);
322 const char *evname = perf_evsel__name(pos); 324 const char *evname = perf_evsel__name(pos);
323 325
324 if (symbol_conf.event_group && 326 if (symbol_conf.event_group &&
@@ -427,7 +429,7 @@ static void report__collapse_hists(struct report *rep)
427 ui_progress__init(&prog, rep->nr_entries, "Merging related events..."); 429 ui_progress__init(&prog, rep->nr_entries, "Merging related events...");
428 430
429 evlist__for_each(rep->session->evlist, pos) { 431 evlist__for_each(rep->session->evlist, pos) {
430 struct hists *hists = &pos->hists; 432 struct hists *hists = evsel__hists(pos);
431 433
432 if (pos->idx == 0) 434 if (pos->idx == 0)
433 hists->symbol_filter_str = rep->symbol_filter_str; 435 hists->symbol_filter_str = rep->symbol_filter_str;
@@ -437,7 +439,7 @@ static void report__collapse_hists(struct report *rep)
437 /* Non-group events are considered as leader */ 439 /* Non-group events are considered as leader */
438 if (symbol_conf.event_group && 440 if (symbol_conf.event_group &&
439 !perf_evsel__is_group_leader(pos)) { 441 !perf_evsel__is_group_leader(pos)) {
440 struct hists *leader_hists = &pos->leader->hists; 442 struct hists *leader_hists = evsel__hists(pos->leader);
441 443
442 hists__match(leader_hists, hists); 444 hists__match(leader_hists, hists);
443 hists__link(leader_hists, hists); 445 hists__link(leader_hists, hists);
@@ -500,7 +502,7 @@ static int __cmd_report(struct report *rep)
500 } 502 }
501 503
502 evlist__for_each(session->evlist, pos) 504 evlist__for_each(session->evlist, pos)
503 hists__output_resort(&pos->hists); 505 hists__output_resort(evsel__hists(pos));
504 506
505 return report__browse_hists(rep); 507 return report__browse_hists(rep);
506} 508}
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index fc3d55f832ac..8ab9716db593 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -251,6 +251,7 @@ static void perf_top__print_sym_table(struct perf_top *top)
251 char bf[160]; 251 char bf[160];
252 int printed = 0; 252 int printed = 0;
253 const int win_width = top->winsize.ws_col - 1; 253 const int win_width = top->winsize.ws_col - 1;
254 struct hists *hists = evsel__hists(top->sym_evsel);
254 255
255 puts(CONSOLE_CLEAR); 256 puts(CONSOLE_CLEAR);
256 257
@@ -261,13 +262,13 @@ static void perf_top__print_sym_table(struct perf_top *top)
261 262
262 printf("%-*.*s\n", win_width, win_width, graph_dotted_line); 263 printf("%-*.*s\n", win_width, win_width, graph_dotted_line);
263 264
264 if (top->sym_evsel->hists.stats.nr_lost_warned != 265 if (hists->stats.nr_lost_warned !=
265 top->sym_evsel->hists.stats.nr_events[PERF_RECORD_LOST]) { 266 hists->stats.nr_events[PERF_RECORD_LOST]) {
266 top->sym_evsel->hists.stats.nr_lost_warned = 267 hists->stats.nr_lost_warned =
267 top->sym_evsel->hists.stats.nr_events[PERF_RECORD_LOST]; 268 hists->stats.nr_events[PERF_RECORD_LOST];
268 color_fprintf(stdout, PERF_COLOR_RED, 269 color_fprintf(stdout, PERF_COLOR_RED,
269 "WARNING: LOST %d chunks, Check IO/CPU overload", 270 "WARNING: LOST %d chunks, Check IO/CPU overload",
270 top->sym_evsel->hists.stats.nr_lost_warned); 271 hists->stats.nr_lost_warned);
271 ++printed; 272 ++printed;
272 } 273 }
273 274
@@ -277,21 +278,18 @@ static void perf_top__print_sym_table(struct perf_top *top)
277 } 278 }
278 279
279 if (top->zero) { 280 if (top->zero) {
280 hists__delete_entries(&top->sym_evsel->hists); 281 hists__delete_entries(hists);
281 } else { 282 } else {
282 hists__decay_entries(&top->sym_evsel->hists, 283 hists__decay_entries(hists, top->hide_user_symbols,
283 top->hide_user_symbols,
284 top->hide_kernel_symbols); 284 top->hide_kernel_symbols);
285 } 285 }
286 286
287 hists__collapse_resort(&top->sym_evsel->hists, NULL); 287 hists__collapse_resort(hists, NULL);
288 hists__output_resort(&top->sym_evsel->hists); 288 hists__output_resort(hists);
289 289
290 hists__output_recalc_col_len(&top->sym_evsel->hists, 290 hists__output_recalc_col_len(hists, top->print_entries - printed);
291 top->print_entries - printed);
292 putchar('\n'); 291 putchar('\n');
293 hists__fprintf(&top->sym_evsel->hists, false, 292 hists__fprintf(hists, false, top->print_entries - printed, win_width,
294 top->print_entries - printed, win_width,
295 top->min_percent, stdout); 293 top->min_percent, stdout);
296} 294}
297 295
@@ -334,6 +332,7 @@ static void perf_top__prompt_symbol(struct perf_top *top, const char *msg)
334{ 332{
335 char *buf = malloc(0), *p; 333 char *buf = malloc(0), *p;
336 struct hist_entry *syme = top->sym_filter_entry, *n, *found = NULL; 334 struct hist_entry *syme = top->sym_filter_entry, *n, *found = NULL;
335 struct hists *hists = evsel__hists(top->sym_evsel);
337 struct rb_node *next; 336 struct rb_node *next;
338 size_t dummy = 0; 337 size_t dummy = 0;
339 338
@@ -351,7 +350,7 @@ static void perf_top__prompt_symbol(struct perf_top *top, const char *msg)
351 if (p) 350 if (p)
352 *p = 0; 351 *p = 0;
353 352
354 next = rb_first(&top->sym_evsel->hists.entries); 353 next = rb_first(&hists->entries);
355 while (next) { 354 while (next) {
356 n = rb_entry(next, struct hist_entry, rb_node); 355 n = rb_entry(next, struct hist_entry, rb_node);
357 if (n->ms.sym && !strcmp(buf, n->ms.sym->name)) { 356 if (n->ms.sym && !strcmp(buf, n->ms.sym->name)) {
@@ -538,21 +537,24 @@ static bool perf_top__handle_keypress(struct perf_top *top, int c)
538static void perf_top__sort_new_samples(void *arg) 537static void perf_top__sort_new_samples(void *arg)
539{ 538{
540 struct perf_top *t = arg; 539 struct perf_top *t = arg;
540 struct hists *hists;
541
541 perf_top__reset_sample_counters(t); 542 perf_top__reset_sample_counters(t);
542 543
543 if (t->evlist->selected != NULL) 544 if (t->evlist->selected != NULL)
544 t->sym_evsel = t->evlist->selected; 545 t->sym_evsel = t->evlist->selected;
545 546
547 hists = evsel__hists(t->sym_evsel);
548
546 if (t->zero) { 549 if (t->zero) {
547 hists__delete_entries(&t->sym_evsel->hists); 550 hists__delete_entries(hists);
548 } else { 551 } else {
549 hists__decay_entries(&t->sym_evsel->hists, 552 hists__decay_entries(hists, t->hide_user_symbols,
550 t->hide_user_symbols,
551 t->hide_kernel_symbols); 553 t->hide_kernel_symbols);
552 } 554 }
553 555
554 hists__collapse_resort(&t->sym_evsel->hists, NULL); 556 hists__collapse_resort(hists, NULL);
555 hists__output_resort(&t->sym_evsel->hists); 557 hists__output_resort(hists);
556} 558}
557 559
558static void *display_thread_tui(void *arg) 560static void *display_thread_tui(void *arg)
@@ -573,8 +575,10 @@ static void *display_thread_tui(void *arg)
573 * Zooming in/out UIDs. For now juse use whatever the user passed 575 * Zooming in/out UIDs. For now juse use whatever the user passed
574 * via --uid. 576 * via --uid.
575 */ 577 */
576 evlist__for_each(top->evlist, pos) 578 evlist__for_each(top->evlist, pos) {
577 pos->hists.uid_filter_str = top->record_opts.target.uid_str; 579 struct hists *hists = evsel__hists(pos);
580 hists->uid_filter_str = top->record_opts.target.uid_str;
581 }
578 582
579 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent, 583 perf_evlist__tui_browse_hists(top->evlist, help, &hbt, top->min_percent,
580 &top->session->header.env); 584 &top->session->header.env);
@@ -768,6 +772,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
768 } 772 }
769 773
770 if (al.sym == NULL || !al.sym->ignore) { 774 if (al.sym == NULL || !al.sym->ignore) {
775 struct hists *hists = evsel__hists(evsel);
771 struct hist_entry_iter iter = { 776 struct hist_entry_iter iter = {
772 .add_entry_cb = hist_iter__top_callback, 777 .add_entry_cb = hist_iter__top_callback,
773 }; 778 };
@@ -777,14 +782,14 @@ static void perf_event__process_sample(struct perf_tool *tool,
777 else 782 else
778 iter.ops = &hist_iter_normal; 783 iter.ops = &hist_iter_normal;
779 784
780 pthread_mutex_lock(&evsel->hists.lock); 785 pthread_mutex_lock(&hists->lock);
781 786
782 err = hist_entry_iter__add(&iter, &al, evsel, sample, 787 err = hist_entry_iter__add(&iter, &al, evsel, sample,
783 top->max_stack, top); 788 top->max_stack, top);
784 if (err < 0) 789 if (err < 0)
785 pr_err("Problem incrementing symbol period, skipping event\n"); 790 pr_err("Problem incrementing symbol period, skipping event\n");
786 791
787 pthread_mutex_unlock(&evsel->hists.lock); 792 pthread_mutex_unlock(&hists->lock);
788 } 793 }
789 794
790 return; 795 return;
@@ -849,7 +854,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
849 perf_event__process_sample(&top->tool, event, evsel, 854 perf_event__process_sample(&top->tool, event, evsel,
850 &sample, machine); 855 &sample, machine);
851 } else if (event->header.type < PERF_RECORD_MAX) { 856 } else if (event->header.type < PERF_RECORD_MAX) {
852 hists__inc_nr_events(&evsel->hists, event->header.type); 857 hists__inc_nr_events(evsel__hists(evsel), event->header.type);
853 machine__process_event(machine, event, &sample); 858 machine__process_event(machine, event, &sample);
854 } else 859 } else
855 ++session->stats.nr_unknown_events; 860 ++session->stats.nr_unknown_events;
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c
index 0ac240db2e24..614d5c4978ab 100644
--- a/tools/perf/tests/hists_cumulate.c
+++ b/tools/perf/tests/hists_cumulate.c
@@ -245,7 +245,7 @@ static int do_test(struct hists *hists, struct result *expected, size_t nr_expec
245static int test1(struct perf_evsel *evsel, struct machine *machine) 245static int test1(struct perf_evsel *evsel, struct machine *machine)
246{ 246{
247 int err; 247 int err;
248 struct hists *hists = &evsel->hists; 248 struct hists *hists = evsel__hists(evsel);
249 /* 249 /*
250 * expected output: 250 * expected output:
251 * 251 *
@@ -295,7 +295,7 @@ out:
295static int test2(struct perf_evsel *evsel, struct machine *machine) 295static int test2(struct perf_evsel *evsel, struct machine *machine)
296{ 296{
297 int err; 297 int err;
298 struct hists *hists = &evsel->hists; 298 struct hists *hists = evsel__hists(evsel);
299 /* 299 /*
300 * expected output: 300 * expected output:
301 * 301 *
@@ -442,7 +442,7 @@ out:
442static int test3(struct perf_evsel *evsel, struct machine *machine) 442static int test3(struct perf_evsel *evsel, struct machine *machine)
443{ 443{
444 int err; 444 int err;
445 struct hists *hists = &evsel->hists; 445 struct hists *hists = evsel__hists(evsel);
446 /* 446 /*
447 * expected output: 447 * expected output:
448 * 448 *
@@ -498,7 +498,7 @@ out:
498static int test4(struct perf_evsel *evsel, struct machine *machine) 498static int test4(struct perf_evsel *evsel, struct machine *machine)
499{ 499{
500 int err; 500 int err;
501 struct hists *hists = &evsel->hists; 501 struct hists *hists = evsel__hists(evsel);
502 /* 502 /*
503 * expected output: 503 * expected output:
504 * 504 *
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c
index 821f581fd930..5a31787cc6b9 100644
--- a/tools/perf/tests/hists_filter.c
+++ b/tools/perf/tests/hists_filter.c
@@ -66,11 +66,12 @@ static int add_hist_entries(struct perf_evlist *evlist,
66 .ops = &hist_iter_normal, 66 .ops = &hist_iter_normal,
67 .hide_unresolved = false, 67 .hide_unresolved = false,
68 }; 68 };
69 struct hists *hists = evsel__hists(evsel);
69 70
70 /* make sure it has no filter at first */ 71 /* make sure it has no filter at first */
71 evsel->hists.thread_filter = NULL; 72 hists->thread_filter = NULL;
72 evsel->hists.dso_filter = NULL; 73 hists->dso_filter = NULL;
73 evsel->hists.symbol_filter_str = NULL; 74 hists->symbol_filter_str = NULL;
74 75
75 sample.pid = fake_samples[i].pid; 76 sample.pid = fake_samples[i].pid;
76 sample.tid = fake_samples[i].pid; 77 sample.tid = fake_samples[i].pid;
@@ -134,7 +135,7 @@ int test__hists_filter(void)
134 goto out; 135 goto out;
135 136
136 evlist__for_each(evlist, evsel) { 137 evlist__for_each(evlist, evsel) {
137 struct hists *hists = &evsel->hists; 138 struct hists *hists = evsel__hists(evsel);
138 139
139 hists__collapse_resort(hists, NULL); 140 hists__collapse_resort(hists, NULL);
140 hists__output_resort(hists); 141 hists__output_resort(hists);
@@ -160,7 +161,7 @@ int test__hists_filter(void)
160 hists->stats.total_non_filtered_period); 161 hists->stats.total_non_filtered_period);
161 162
162 /* now applying thread filter for 'bash' */ 163 /* now applying thread filter for 'bash' */
163 evsel->hists.thread_filter = fake_samples[9].thread; 164 hists->thread_filter = fake_samples[9].thread;
164 hists__filter_by_thread(hists); 165 hists__filter_by_thread(hists);
165 166
166 if (verbose > 2) { 167 if (verbose > 2) {
@@ -185,11 +186,11 @@ int test__hists_filter(void)
185 hists->stats.total_non_filtered_period == 400); 186 hists->stats.total_non_filtered_period == 400);
186 187
187 /* remove thread filter first */ 188 /* remove thread filter first */
188 evsel->hists.thread_filter = NULL; 189 hists->thread_filter = NULL;
189 hists__filter_by_thread(hists); 190 hists__filter_by_thread(hists);
190 191
191 /* now applying dso filter for 'kernel' */ 192 /* now applying dso filter for 'kernel' */
192 evsel->hists.dso_filter = fake_samples[0].map->dso; 193 hists->dso_filter = fake_samples[0].map->dso;
193 hists__filter_by_dso(hists); 194 hists__filter_by_dso(hists);
194 195
195 if (verbose > 2) { 196 if (verbose > 2) {
@@ -214,7 +215,7 @@ int test__hists_filter(void)
214 hists->stats.total_non_filtered_period == 300); 215 hists->stats.total_non_filtered_period == 300);
215 216
216 /* remove dso filter first */ 217 /* remove dso filter first */
217 evsel->hists.dso_filter = NULL; 218 hists->dso_filter = NULL;
218 hists__filter_by_dso(hists); 219 hists__filter_by_dso(hists);
219 220
220 /* 221 /*
@@ -224,7 +225,7 @@ int test__hists_filter(void)
224 * be counted as a separate entry but the sample count and 225 * be counted as a separate entry but the sample count and
225 * total period will be remained. 226 * total period will be remained.
226 */ 227 */
227 evsel->hists.symbol_filter_str = "main"; 228 hists->symbol_filter_str = "main";
228 hists__filter_by_symbol(hists); 229 hists__filter_by_symbol(hists);
229 230
230 if (verbose > 2) { 231 if (verbose > 2) {
@@ -249,8 +250,8 @@ int test__hists_filter(void)
249 hists->stats.total_non_filtered_period == 300); 250 hists->stats.total_non_filtered_period == 300);
250 251
251 /* now applying all filters at once. */ 252 /* now applying all filters at once. */
252 evsel->hists.thread_filter = fake_samples[1].thread; 253 hists->thread_filter = fake_samples[1].thread;
253 evsel->hists.dso_filter = fake_samples[1].map->dso; 254 hists->dso_filter = fake_samples[1].map->dso;
254 hists__filter_by_thread(hists); 255 hists__filter_by_thread(hists);
255 hists__filter_by_dso(hists); 256 hists__filter_by_dso(hists);
256 257
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index d4b34b0f50a2..278ba8344c23 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -73,6 +73,8 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
73 * "bash [libc] malloc" so total 9 entries will be in the tree. 73 * "bash [libc] malloc" so total 9 entries will be in the tree.
74 */ 74 */
75 evlist__for_each(evlist, evsel) { 75 evlist__for_each(evlist, evsel) {
76 struct hists *hists = evsel__hists(evsel);
77
76 for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { 78 for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
77 const union perf_event event = { 79 const union perf_event event = {
78 .header = { 80 .header = {
@@ -87,7 +89,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
87 &sample) < 0) 89 &sample) < 0)
88 goto out; 90 goto out;
89 91
90 he = __hists__add_entry(&evsel->hists, &al, NULL, 92 he = __hists__add_entry(hists, &al, NULL,
91 NULL, NULL, 1, 1, 0, true); 93 NULL, NULL, 1, 1, 0, true);
92 if (he == NULL) 94 if (he == NULL)
93 goto out; 95 goto out;
@@ -111,7 +113,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
111 &sample) < 0) 113 &sample) < 0)
112 goto out; 114 goto out;
113 115
114 he = __hists__add_entry(&evsel->hists, &al, NULL, 116 he = __hists__add_entry(hists, &al, NULL,
115 NULL, NULL, 1, 1, 0, true); 117 NULL, NULL, 1, 1, 0, true);
116 if (he == NULL) 118 if (he == NULL)
117 goto out; 119 goto out;
@@ -271,6 +273,7 @@ static int validate_link(struct hists *leader, struct hists *other)
271int test__hists_link(void) 273int test__hists_link(void)
272{ 274{
273 int err = -1; 275 int err = -1;
276 struct hists *hists, *first_hists;
274 struct machines machines; 277 struct machines machines;
275 struct machine *machine = NULL; 278 struct machine *machine = NULL;
276 struct perf_evsel *evsel, *first; 279 struct perf_evsel *evsel, *first;
@@ -306,24 +309,28 @@ int test__hists_link(void)
306 goto out; 309 goto out;
307 310
308 evlist__for_each(evlist, evsel) { 311 evlist__for_each(evlist, evsel) {
309 hists__collapse_resort(&evsel->hists, NULL); 312 hists = evsel__hists(evsel);
313 hists__collapse_resort(hists, NULL);
310 314
311 if (verbose > 2) 315 if (verbose > 2)
312 print_hists_in(&evsel->hists); 316 print_hists_in(hists);
313 } 317 }
314 318
315 first = perf_evlist__first(evlist); 319 first = perf_evlist__first(evlist);
316 evsel = perf_evlist__last(evlist); 320 evsel = perf_evlist__last(evlist);
317 321
322 first_hists = evsel__hists(first);
323 hists = evsel__hists(evsel);
324
318 /* match common entries */ 325 /* match common entries */
319 hists__match(&first->hists, &evsel->hists); 326 hists__match(first_hists, hists);
320 err = validate_match(&first->hists, &evsel->hists); 327 err = validate_match(first_hists, hists);
321 if (err) 328 if (err)
322 goto out; 329 goto out;
323 330
324 /* link common and/or dummy entries */ 331 /* link common and/or dummy entries */
325 hists__link(&first->hists, &evsel->hists); 332 hists__link(first_hists, hists);
326 err = validate_link(&first->hists, &evsel->hists); 333 err = validate_link(first_hists, hists);
327 if (err) 334 if (err)
328 goto out; 335 goto out;
329 336
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c
index e3bbd6c54c1b..a748f2be1222 100644
--- a/tools/perf/tests/hists_output.c
+++ b/tools/perf/tests/hists_output.c
@@ -122,7 +122,7 @@ typedef int (*test_fn_t)(struct perf_evsel *, struct machine *);
122static int test1(struct perf_evsel *evsel, struct machine *machine) 122static int test1(struct perf_evsel *evsel, struct machine *machine)
123{ 123{
124 int err; 124 int err;
125 struct hists *hists = &evsel->hists; 125 struct hists *hists = evsel__hists(evsel);
126 struct hist_entry *he; 126 struct hist_entry *he;
127 struct rb_root *root; 127 struct rb_root *root;
128 struct rb_node *node; 128 struct rb_node *node;
@@ -159,7 +159,7 @@ static int test1(struct perf_evsel *evsel, struct machine *machine)
159 print_hists_out(hists); 159 print_hists_out(hists);
160 } 160 }
161 161
162 root = &evsel->hists.entries; 162 root = &hists->entries;
163 node = rb_first(root); 163 node = rb_first(root);
164 he = rb_entry(node, struct hist_entry, rb_node); 164 he = rb_entry(node, struct hist_entry, rb_node);
165 TEST_ASSERT_VAL("Invalid hist entry", 165 TEST_ASSERT_VAL("Invalid hist entry",
@@ -224,7 +224,7 @@ out:
224static int test2(struct perf_evsel *evsel, struct machine *machine) 224static int test2(struct perf_evsel *evsel, struct machine *machine)
225{ 225{
226 int err; 226 int err;
227 struct hists *hists = &evsel->hists; 227 struct hists *hists = evsel__hists(evsel);
228 struct hist_entry *he; 228 struct hist_entry *he;
229 struct rb_root *root; 229 struct rb_root *root;
230 struct rb_node *node; 230 struct rb_node *node;
@@ -259,7 +259,7 @@ static int test2(struct perf_evsel *evsel, struct machine *machine)
259 print_hists_out(hists); 259 print_hists_out(hists);
260 } 260 }
261 261
262 root = &evsel->hists.entries; 262 root = &hists->entries;
263 node = rb_first(root); 263 node = rb_first(root);
264 he = rb_entry(node, struct hist_entry, rb_node); 264 he = rb_entry(node, struct hist_entry, rb_node);
265 TEST_ASSERT_VAL("Invalid hist entry", 265 TEST_ASSERT_VAL("Invalid hist entry",
@@ -280,7 +280,7 @@ out:
280static int test3(struct perf_evsel *evsel, struct machine *machine) 280static int test3(struct perf_evsel *evsel, struct machine *machine)
281{ 281{
282 int err; 282 int err;
283 struct hists *hists = &evsel->hists; 283 struct hists *hists = evsel__hists(evsel);
284 struct hist_entry *he; 284 struct hist_entry *he;
285 struct rb_root *root; 285 struct rb_root *root;
286 struct rb_node *node; 286 struct rb_node *node;
@@ -313,7 +313,7 @@ static int test3(struct perf_evsel *evsel, struct machine *machine)
313 print_hists_out(hists); 313 print_hists_out(hists);
314 } 314 }
315 315
316 root = &evsel->hists.entries; 316 root = &hists->entries;
317 node = rb_first(root); 317 node = rb_first(root);
318 he = rb_entry(node, struct hist_entry, rb_node); 318 he = rb_entry(node, struct hist_entry, rb_node);
319 TEST_ASSERT_VAL("Invalid hist entry", 319 TEST_ASSERT_VAL("Invalid hist entry",
@@ -354,7 +354,7 @@ out:
354static int test4(struct perf_evsel *evsel, struct machine *machine) 354static int test4(struct perf_evsel *evsel, struct machine *machine)
355{ 355{
356 int err; 356 int err;
357 struct hists *hists = &evsel->hists; 357 struct hists *hists = evsel__hists(evsel);
358 struct hist_entry *he; 358 struct hist_entry *he;
359 struct rb_root *root; 359 struct rb_root *root;
360 struct rb_node *node; 360 struct rb_node *node;
@@ -391,7 +391,7 @@ static int test4(struct perf_evsel *evsel, struct machine *machine)
391 print_hists_out(hists); 391 print_hists_out(hists);
392 } 392 }
393 393
394 root = &evsel->hists.entries; 394 root = &hists->entries;
395 node = rb_first(root); 395 node = rb_first(root);
396 he = rb_entry(node, struct hist_entry, rb_node); 396 he = rb_entry(node, struct hist_entry, rb_node);
397 TEST_ASSERT_VAL("Invalid hist entry", 397 TEST_ASSERT_VAL("Invalid hist entry",
@@ -456,7 +456,7 @@ out:
456static int test5(struct perf_evsel *evsel, struct machine *machine) 456static int test5(struct perf_evsel *evsel, struct machine *machine)
457{ 457{
458 int err; 458 int err;
459 struct hists *hists = &evsel->hists; 459 struct hists *hists = evsel__hists(evsel);
460 struct hist_entry *he; 460 struct hist_entry *he;
461 struct rb_root *root; 461 struct rb_root *root;
462 struct rb_node *node; 462 struct rb_node *node;
@@ -494,7 +494,7 @@ static int test5(struct perf_evsel *evsel, struct machine *machine)
494 print_hists_out(hists); 494 print_hists_out(hists);
495 } 495 }
496 496
497 root = &evsel->hists.entries; 497 root = &hists->entries;
498 node = rb_first(root); 498 node = rb_first(root);
499 he = rb_entry(node, struct hist_entry, rb_node); 499 he = rb_entry(node, struct hist_entry, rb_node);
500 500
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index 8f60a970404f..68eab9ea1634 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1229,12 +1229,14 @@ static int hists__browser_title(struct hists *hists, char *bf, size_t size)
1229 ev_name = buf; 1229 ev_name = buf;
1230 1230
1231 for_each_group_member(pos, evsel) { 1231 for_each_group_member(pos, evsel) {
1232 struct hists *pos_hists = evsel__hists(pos);
1233
1232 if (symbol_conf.filter_relative) { 1234 if (symbol_conf.filter_relative) {
1233 nr_samples += pos->hists.stats.nr_non_filtered_samples; 1235 nr_samples += pos_hists->stats.nr_non_filtered_samples;
1234 nr_events += pos->hists.stats.total_non_filtered_period; 1236 nr_events += pos_hists->stats.total_non_filtered_period;
1235 } else { 1237 } else {
1236 nr_samples += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1238 nr_samples += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE];
1237 nr_events += pos->hists.stats.total_period; 1239 nr_events += pos_hists->stats.total_period;
1238 } 1240 }
1239 } 1241 }
1240 } 1242 }
@@ -1387,7 +1389,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
1387 float min_pcnt, 1389 float min_pcnt,
1388 struct perf_session_env *env) 1390 struct perf_session_env *env)
1389{ 1391{
1390 struct hists *hists = &evsel->hists; 1392 struct hists *hists = evsel__hists(evsel);
1391 struct hist_browser *browser = hist_browser__new(hists); 1393 struct hist_browser *browser = hist_browser__new(hists);
1392 struct branch_info *bi; 1394 struct branch_info *bi;
1393 struct pstack *fstack; 1395 struct pstack *fstack;
@@ -1802,8 +1804,9 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
1802 struct perf_evsel_menu *menu = container_of(browser, 1804 struct perf_evsel_menu *menu = container_of(browser,
1803 struct perf_evsel_menu, b); 1805 struct perf_evsel_menu, b);
1804 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node); 1806 struct perf_evsel *evsel = list_entry(entry, struct perf_evsel, node);
1807 struct hists *hists = evsel__hists(evsel);
1805 bool current_entry = ui_browser__is_current_entry(browser, row); 1808 bool current_entry = ui_browser__is_current_entry(browser, row);
1806 unsigned long nr_events = evsel->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1809 unsigned long nr_events = hists->stats.nr_events[PERF_RECORD_SAMPLE];
1807 const char *ev_name = perf_evsel__name(evsel); 1810 const char *ev_name = perf_evsel__name(evsel);
1808 char bf[256], unit; 1811 char bf[256], unit;
1809 const char *warn = " "; 1812 const char *warn = " ";
@@ -1818,7 +1821,8 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
1818 ev_name = perf_evsel__group_name(evsel); 1821 ev_name = perf_evsel__group_name(evsel);
1819 1822
1820 for_each_group_member(pos, evsel) { 1823 for_each_group_member(pos, evsel) {
1821 nr_events += pos->hists.stats.nr_events[PERF_RECORD_SAMPLE]; 1824 struct hists *pos_hists = evsel__hists(pos);
1825 nr_events += pos_hists->stats.nr_events[PERF_RECORD_SAMPLE];
1822 } 1826 }
1823 } 1827 }
1824 1828
@@ -1827,7 +1831,7 @@ static void perf_evsel_menu__write(struct ui_browser *browser,
1827 unit, unit == ' ' ? "" : " ", ev_name); 1831 unit, unit == ' ' ? "" : " ", ev_name);
1828 slsmg_printf("%s", bf); 1832 slsmg_printf("%s", bf);
1829 1833
1830 nr_events = evsel->hists.stats.nr_events[PERF_RECORD_LOST]; 1834 nr_events = hists->stats.nr_events[PERF_RECORD_LOST];
1831 if (nr_events != 0) { 1835 if (nr_events != 0) {
1832 menu->lost_events = true; 1836 menu->lost_events = true;
1833 if (!current_entry) 1837 if (!current_entry)
diff --git a/tools/perf/ui/gtk/hists.c b/tools/perf/ui/gtk/hists.c
index f3fa4258b256..fc654fb77ace 100644
--- a/tools/perf/ui/gtk/hists.c
+++ b/tools/perf/ui/gtk/hists.c
@@ -319,7 +319,7 @@ int perf_evlist__gtk_browse_hists(struct perf_evlist *evlist,
319 gtk_container_add(GTK_CONTAINER(window), vbox); 319 gtk_container_add(GTK_CONTAINER(window), vbox);
320 320
321 evlist__for_each(evlist, pos) { 321 evlist__for_each(evlist, pos) {
322 struct hists *hists = &pos->hists; 322 struct hists *hists = evsel__hists(pos);
323 const char *evname = perf_evsel__name(pos); 323 const char *evname = perf_evsel__name(pos);
324 GtkWidget *scrolled_window; 324 GtkWidget *scrolled_window;
325 GtkWidget *tab_label; 325 GtkWidget *tab_label;
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index 7bc314be6a7b..ff72ce058724 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -102,6 +102,11 @@ union u64_swap {
102 102
103#define hists_to_evsel(h) container_of(h, struct perf_evsel, hists) 103#define hists_to_evsel(h) container_of(h, struct perf_evsel, hists)
104 104
105static inline struct hists *evsel__hists(struct perf_evsel *evsel)
106{
107 return &evsel->hists;
108}
109
105struct cpu_map; 110struct cpu_map;
106struct thread_map; 111struct thread_map;
107struct perf_evlist; 112struct perf_evlist;
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b47595697140..f72ad9c36e39 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -509,6 +509,7 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al
509{ 509{
510 u64 cost; 510 u64 cost;
511 struct mem_info *mi = iter->priv; 511 struct mem_info *mi = iter->priv;
512 struct hists *hists = evsel__hists(iter->evsel);
512 struct hist_entry *he; 513 struct hist_entry *he;
513 514
514 if (mi == NULL) 515 if (mi == NULL)
@@ -525,7 +526,7 @@ iter_add_single_mem_entry(struct hist_entry_iter *iter, struct addr_location *al
525 * and this is indirectly achieved by passing period=weight here 526 * and this is indirectly achieved by passing period=weight here
526 * and the he_stat__add_period() function. 527 * and the he_stat__add_period() function.
527 */ 528 */
528 he = __hists__add_entry(&iter->evsel->hists, al, iter->parent, NULL, mi, 529 he = __hists__add_entry(hists, al, iter->parent, NULL, mi,
529 cost, cost, 0, true); 530 cost, cost, 0, true);
530 if (!he) 531 if (!he)
531 return -ENOMEM; 532 return -ENOMEM;
@@ -539,13 +540,14 @@ iter_finish_mem_entry(struct hist_entry_iter *iter,
539 struct addr_location *al __maybe_unused) 540 struct addr_location *al __maybe_unused)
540{ 541{
541 struct perf_evsel *evsel = iter->evsel; 542 struct perf_evsel *evsel = iter->evsel;
543 struct hists *hists = evsel__hists(evsel);
542 struct hist_entry *he = iter->he; 544 struct hist_entry *he = iter->he;
543 int err = -EINVAL; 545 int err = -EINVAL;
544 546
545 if (he == NULL) 547 if (he == NULL)
546 goto out; 548 goto out;
547 549
548 hists__inc_nr_samples(&evsel->hists, he->filtered); 550 hists__inc_nr_samples(hists, he->filtered);
549 551
550 err = hist_entry__append_callchain(he, iter->sample); 552 err = hist_entry__append_callchain(he, iter->sample);
551 553
@@ -611,6 +613,7 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a
611{ 613{
612 struct branch_info *bi; 614 struct branch_info *bi;
613 struct perf_evsel *evsel = iter->evsel; 615 struct perf_evsel *evsel = iter->evsel;
616 struct hists *hists = evsel__hists(evsel);
614 struct hist_entry *he = NULL; 617 struct hist_entry *he = NULL;
615 int i = iter->curr; 618 int i = iter->curr;
616 int err = 0; 619 int err = 0;
@@ -624,12 +627,12 @@ iter_add_next_branch_entry(struct hist_entry_iter *iter, struct addr_location *a
624 * The report shows the percentage of total branches captured 627 * The report shows the percentage of total branches captured
625 * and not events sampled. Thus we use a pseudo period of 1. 628 * and not events sampled. Thus we use a pseudo period of 1.
626 */ 629 */
627 he = __hists__add_entry(&evsel->hists, al, iter->parent, &bi[i], NULL, 630 he = __hists__add_entry(hists, al, iter->parent, &bi[i], NULL,
628 1, 1, 0, true); 631 1, 1, 0, true);
629 if (he == NULL) 632 if (he == NULL)
630 return -ENOMEM; 633 return -ENOMEM;
631 634
632 hists__inc_nr_samples(&evsel->hists, he->filtered); 635 hists__inc_nr_samples(hists, he->filtered);
633 636
634out: 637out:
635 iter->he = he; 638 iter->he = he;
@@ -661,7 +664,7 @@ iter_add_single_normal_entry(struct hist_entry_iter *iter, struct addr_location
661 struct perf_sample *sample = iter->sample; 664 struct perf_sample *sample = iter->sample;
662 struct hist_entry *he; 665 struct hist_entry *he;
663 666
664 he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, 667 he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
665 sample->period, sample->weight, 668 sample->period, sample->weight,
666 sample->transaction, true); 669 sample->transaction, true);
667 if (he == NULL) 670 if (he == NULL)
@@ -684,7 +687,7 @@ iter_finish_normal_entry(struct hist_entry_iter *iter,
684 687
685 iter->he = NULL; 688 iter->he = NULL;
686 689
687 hists__inc_nr_samples(&evsel->hists, he->filtered); 690 hists__inc_nr_samples(evsel__hists(evsel), he->filtered);
688 691
689 return hist_entry__append_callchain(he, sample); 692 return hist_entry__append_callchain(he, sample);
690} 693}
@@ -717,12 +720,13 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,
717 struct addr_location *al) 720 struct addr_location *al)
718{ 721{
719 struct perf_evsel *evsel = iter->evsel; 722 struct perf_evsel *evsel = iter->evsel;
723 struct hists *hists = evsel__hists(evsel);
720 struct perf_sample *sample = iter->sample; 724 struct perf_sample *sample = iter->sample;
721 struct hist_entry **he_cache = iter->priv; 725 struct hist_entry **he_cache = iter->priv;
722 struct hist_entry *he; 726 struct hist_entry *he;
723 int err = 0; 727 int err = 0;
724 728
725 he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, 729 he = __hists__add_entry(hists, al, iter->parent, NULL, NULL,
726 sample->period, sample->weight, 730 sample->period, sample->weight,
727 sample->transaction, true); 731 sample->transaction, true);
728 if (he == NULL) 732 if (he == NULL)
@@ -739,7 +743,7 @@ iter_add_single_cumulative_entry(struct hist_entry_iter *iter,
739 */ 743 */
740 callchain_cursor_commit(&callchain_cursor); 744 callchain_cursor_commit(&callchain_cursor);
741 745
742 hists__inc_nr_samples(&evsel->hists, he->filtered); 746 hists__inc_nr_samples(hists, he->filtered);
743 747
744 return err; 748 return err;
745} 749}
@@ -795,7 +799,7 @@ iter_add_next_cumulative_entry(struct hist_entry_iter *iter,
795 } 799 }
796 } 800 }
797 801
798 he = __hists__add_entry(&evsel->hists, al, iter->parent, NULL, NULL, 802 he = __hists__add_entry(evsel__hists(evsel), al, iter->parent, NULL, NULL,
799 sample->period, sample->weight, 803 sample->period, sample->weight,
800 sample->transaction, false); 804 sample->transaction, false);
801 if (he == NULL) 805 if (he == NULL)
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 883406f4b381..1d423548862f 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -827,7 +827,7 @@ int perf_session__deliver_event(struct perf_session *session,
827 * future probably it'll be a good idea to restrict event 827 * future probably it'll be a good idea to restrict event
828 * processing via perf_session to files with both set. 828 * processing via perf_session to files with both set.
829 */ 829 */
830 hists__inc_nr_events(&evsel->hists, event->header.type); 830 hists__inc_nr_events(evsel__hists(evsel), event->header.type);
831 } 831 }
832 832
833 machine = perf_session__find_machine_for_cpumode(session, event, 833 machine = perf_session__find_machine_for_cpumode(session, event,
@@ -1398,7 +1398,7 @@ size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
1398 1398
1399 evlist__for_each(session->evlist, pos) { 1399 evlist__for_each(session->evlist, pos) {
1400 ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos)); 1400 ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos));
1401 ret += events_stats__fprintf(&pos->hists.stats, fp); 1401 ret += events_stats__fprintf(&evsel__hists(pos)->stats, fp);
1402 } 1402 }
1403 1403
1404 return ret; 1404 return ret;
diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c
index 289df9d1e65a..4906cd81cb56 100644
--- a/tools/perf/util/sort.c
+++ b/tools/perf/util/sort.c
@@ -1218,7 +1218,7 @@ static int __sort__hpp_header(struct perf_hpp_fmt *fmt, struct perf_hpp *hpp,
1218 hse = container_of(fmt, struct hpp_sort_entry, hpp); 1218 hse = container_of(fmt, struct hpp_sort_entry, hpp);
1219 1219
1220 if (!len) 1220 if (!len)
1221 len = hists__col_len(&evsel->hists, hse->se->se_width_idx); 1221 len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx);
1222 1222
1223 return scnprintf(hpp->buf, hpp->size, "%-*.*s", len, len, fmt->name); 1223 return scnprintf(hpp->buf, hpp->size, "%-*.*s", len, len, fmt->name);
1224} 1224}
@@ -1233,7 +1233,7 @@ static int __sort__hpp_width(struct perf_hpp_fmt *fmt,
1233 hse = container_of(fmt, struct hpp_sort_entry, hpp); 1233 hse = container_of(fmt, struct hpp_sort_entry, hpp);
1234 1234
1235 if (!len) 1235 if (!len)
1236 len = hists__col_len(&evsel->hists, hse->se->se_width_idx); 1236 len = hists__col_len(evsel__hists(evsel), hse->se->se_width_idx);
1237 1237
1238 return len; 1238 return len;
1239} 1239}