return color;
 }
 
-static struct evsel *perf_stat__find_event(struct evlist *evsel_list,
-                                               const char *name)
-{
-       struct evsel *c2;
-
-       evlist__for_each_entry (evsel_list, c2) {
-               if (!strcasecmp(c2->name, name) && !c2->collect_stat)
-                       return c2;
-       }
-       return NULL;
-}
-
-/* Mark MetricExpr target events and link events using them to them. */
-void perf_stat__collect_metric_expr(struct evlist *evsel_list)
-{
-       struct evsel *counter, *leader, **metric_events, *oc;
-       bool found;
-       struct expr_parse_ctx *ctx;
-       struct hashmap_entry *cur;
-       size_t bkt;
-       int i;
-
-       ctx = expr__ctx_new();
-       if (!ctx) {
-               pr_debug("expr__ctx_new failed");
-               return;
-       }
-       evlist__for_each_entry(evsel_list, counter) {
-               bool invalid = false;
-
-               leader = evsel__leader(counter);
-               if (!counter->metric_expr)
-                       continue;
-
-               expr__ctx_clear(ctx);
-               metric_events = counter->metric_events;
-               if (!metric_events) {
-                       if (expr__find_ids(counter->metric_expr,
-                                          counter->name,
-                                          ctx) < 0)
-                               continue;
-
-                       metric_events = calloc(sizeof(struct evsel *),
-                                              hashmap__size(ctx->ids) + 1);
-                       if (!metric_events) {
-                               expr__ctx_free(ctx);
-                               return;
-                       }
-                       counter->metric_events = metric_events;
-               }
-
-               i = 0;
-               hashmap__for_each_entry(ctx->ids, cur, bkt) {
-                       const char *metric_name = cur->pkey;
-
-                       found = false;
-                       if (leader) {
-                               /* Search in group */
-                               for_each_group_member (oc, leader) {
-                                       if (!strcasecmp(oc->name,
-                                                       metric_name) &&
-                                               !oc->collect_stat) {
-                                               found = true;
-                                               break;
-                                       }
-                               }
-                       }
-                       if (!found) {
-                               /* Search ignoring groups */
-                               oc = perf_stat__find_event(evsel_list,
-                                                          metric_name);
-                       }
-                       if (!oc) {
-                               /* Deduping one is good enough to handle duplicated PMUs. */
-                               static char *printed;
-
-                               /*
-                                * Adding events automatically would be difficult, because
-                                * it would risk creating groups that are not schedulable.
-                                * perf stat doesn't understand all the scheduling constraints
-                                * of events. So we ask the user instead to add the missing
-                                * events.
-                                */
-                               if (!printed ||
-                                   strcasecmp(printed, metric_name)) {
-                                       fprintf(stderr,
-                                               "Add %s event to groups to get metric expression for %s\n",
-                                               metric_name,
-                                               counter->name);
-                                       free(printed);
-                                       printed = strdup(metric_name);
-                               }
-                               invalid = true;
-                               continue;
-                       }
-                       metric_events[i++] = oc;
-                       oc->collect_stat = true;
-               }
-               metric_events[i] = NULL;
-               if (invalid) {
-                       free(metric_events);
-                       counter->metric_events = NULL;
-                       counter->metric_expr = NULL;
-               }
-       }
-       expr__ctx_free(ctx);
-}
-
 static double runtime_stat_avg(struct runtime_stat *st,
                               enum stat_type type, int map_idx,
                               struct runtime_stat_data *rsd)
                        color = NULL;
                print_metric(config, ctxp, color, "%8.1f%%", "Core Bound",
                                core_bound * 100.);
-       } else if (evsel->metric_expr) {
-               generic_metric(config, evsel->metric_expr, evsel->metric_events, NULL,
-                              evsel->name, evsel->metric_name, NULL, 1,
-                              map_idx, out, st);
        } else if (runtime_stat_n(st, STAT_NSECS, map_idx, &rsd) != 0) {
                char unit = ' ';
                char unit_buf[10] = "/sec";