Merge tag 'arm-soc-fixes-5.13-1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / tools / perf / builtin-record.c
index 6af46c6..3337b5f 100644 (file)
@@ -1605,6 +1605,32 @@ static void hit_auxtrace_snapshot_trigger(struct record *rec)
        }
 }
 
+static void record__uniquify_name(struct record *rec)
+{
+       struct evsel *pos;
+       struct evlist *evlist = rec->evlist;
+       char *new_name;
+       int ret;
+
+       if (!perf_pmu__has_hybrid())
+               return;
+
+       evlist__for_each_entry(evlist, pos) {
+               if (!evsel__is_hybrid(pos))
+                       continue;
+
+               if (strchr(pos->name, '/'))
+                       continue;
+
+               ret = asprintf(&new_name, "%s/%s/",
+                              pos->pmu_name, pos->name);
+               if (ret) {
+                       free(pos->name);
+                       pos->name = new_name;
+               }
+       }
+}
+
 static int __cmd_record(struct record *rec, int argc, const char **argv)
 {
        int err;
@@ -1709,6 +1735,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv)
        if (data->is_pipe && rec->evlist->core.nr_entries == 1)
                rec->opts.sample_id = true;
 
+       record__uniquify_name(rec);
+
        if (record__open(rec) != 0) {
                err = -1;
                goto out_child;