pthread_mutex_unlock(¬es->lock);
 }
 
-static void evlist__resort_hists(struct evlist *evlist)
+static void perf_top__resort_hists(struct perf_top *t)
 {
+       struct evlist *evlist = t->evlist;
        struct evsel *pos;
 
        evlist__for_each_entry(evlist, pos) {
                struct hists *hists = evsel__hists(pos);
 
+               if (evlist->enabled) {
+                       if (t->zero) {
+                               hists__delete_entries(hists);
+                       } else {
+                               hists__decay_entries(hists, t->hide_user_symbols,
+                                                    t->hide_kernel_symbols);
+                       }
+               }
+
                hists__collapse_resort(hists, NULL);
 
                /* Non-group events are considered as leader */
                return;
        }
 
-       if (top->evlist->enabled) {
-               if (top->zero) {
-                       hists__delete_entries(hists);
-               } else {
-                       hists__decay_entries(hists, top->hide_user_symbols,
-                                            top->hide_kernel_symbols);
-               }
-       }
-
-       evlist__resort_hists(top->evlist);
+       perf_top__resort_hists(top);
 
        hists__output_recalc_col_len(hists, top->print_entries - printed);
        putchar('\n');
 static void perf_top__sort_new_samples(void *arg)
 {
        struct perf_top *t = arg;
-       struct evsel *evsel = t->sym_evsel;
-       struct hists *hists;
 
        if (t->evlist->selected != NULL)
                t->sym_evsel = t->evlist->selected;
 
-       hists = evsel__hists(evsel);
-
-       if (t->evlist->enabled) {
-               if (t->zero) {
-                       hists__delete_entries(hists);
-               } else {
-                       hists__decay_entries(hists, t->hide_user_symbols,
-                                            t->hide_kernel_symbols);
-               }
-       }
-
-       evlist__resort_hists(t->evlist);
+       perf_top__resort_hists(t);
 
        if (t->lost || t->drop)
                pr_warning("Too slow to read ring buffer (change period (-c/-F) or limit CPUs (-C)\n");