if (nr_samples > 0) {
                        total_nr_samples += nr_samples;
-                       hists__collapse_resort(hists);
+                       hists__collapse_resort(hists, NULL);
                        hists__output_resort(hists);
 
                        if (symbol_conf.event_group &&
 
        list_for_each_entry(evsel, &evlist->entries, node) {
                struct hists *hists = &evsel->hists;
 
-               hists__collapse_resort(hists);
+               hists__collapse_resort(hists, NULL);
        }
 }
 
 
        struct map *kernel_map;
        struct kmap *kernel_kmap;
        const char *help = "For a higher level overview, try: perf report --sort comm,dso";
+       struct ui_progress prog;
        struct perf_data_file *file = session->file;
 
        signal(SIGINT, sig_handler);
                return 0;
        }
 
+       nr_samples = 0;
+       list_for_each_entry(pos, &session->evlist->entries, node)
+               nr_samples += pos->hists.nr_entries;
+
+       ui_progress__init(&prog, nr_samples, "Merging related events...");
+
        nr_samples = 0;
        list_for_each_entry(pos, &session->evlist->entries, node) {
                struct hists *hists = &pos->hists;
                if (pos->idx == 0)
                        hists->symbol_filter_str = rep->symbol_filter_str;
 
-               hists__collapse_resort(hists);
+               hists__collapse_resort(hists, &prog);
                nr_samples += hists->stats.nr_events[PERF_RECORD_SAMPLE];
 
                /* Non-group events are considered as leader */
                        hists__link(leader_hists, hists);
                }
        }
+       ui_progress__finish();
 
        if (session_done())
                return 0;
 
                return;
        }
 
-       hists__collapse_resort(&top->sym_evsel->hists);
+       hists__collapse_resort(&top->sym_evsel->hists, NULL);
        hists__output_resort(&top->sym_evsel->hists);
        hists__decay_entries(&top->sym_evsel->hists,
                             top->hide_user_symbols,
        if (t->evlist->selected != NULL)
                t->sym_evsel = t->evlist->selected;
 
-       hists__collapse_resort(&t->sym_evsel->hists);
+       hists__collapse_resort(&t->sym_evsel->hists, NULL);
        hists__output_resort(&t->sym_evsel->hists);
        hists__decay_entries(&t->sym_evsel->hists,
                             t->hide_user_symbols,
 
                goto out;
 
        list_for_each_entry(evsel, &evlist->entries, node) {
-               hists__collapse_resort(&evsel->hists);
+               hists__collapse_resort(&evsel->hists, NULL);
 
                if (verbose > 2)
                        print_hists(&evsel->hists);
 
        if (!he)
                return NULL;
 
+       hists->nr_entries++;
        rb_link_node(&he->rb_node_in, parent, p);
        rb_insert_color(&he->rb_node_in, hists->entries_in);
 out:
        hists__filter_entry_by_symbol(hists, he);
 }
 
-void hists__collapse_resort(struct hists *hists)
+void hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
 {
        struct rb_root *root;
        struct rb_node *next;
                         */
                        hists__apply_filters(hists, n);
                }
+               if (prog)
+                       ui_progress__update(prog, 1);
        }
 }
 
 
 #include <pthread.h>
 #include "callchain.h"
 #include "header.h"
+#include "ui/progress.h"
 
 extern struct callchain_param callchain_param;
 
                                          u64 weight);
 
 void hists__output_resort(struct hists *self);
-void hists__collapse_resort(struct hists *self);
+void hists__collapse_resort(struct hists *self, struct ui_progress *prog);
 
 void hists__decay_entries(struct hists *hists, bool zap_user, bool zap_kernel);
 void hists__output_recalc_col_len(struct hists *hists, int max_rows);