perf evlist: Change the COMM when preparing the workload
[sfrench/cifs-2.6.git] / tools / perf / util / evlist.c
index 5121b4db66fe5d58abc48aab2b2a025240a8eb51..435bbfd005514a4abe539b94de0eaf5626cdec80 100644 (file)
@@ -36,6 +36,7 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/mman.h>
+#include <sys/prctl.h>
 
 #include <linux/bitops.h>
 #include <linux/hash.h>
@@ -1306,6 +1307,7 @@ void evlist__close(struct evlist *evlist)
                perf_evsel__free_fd(&evsel->core);
                perf_evsel__free_id(&evsel->core);
        }
+       perf_evlist__reset_id_hash(&evlist->core);
 }
 
 static int evlist__create_syswide_maps(struct evlist *evlist)
@@ -1404,6 +1406,13 @@ int evlist__prepare_workload(struct evlist *evlist, struct target *target, const
                close(go_pipe[1]);
                fcntl(go_pipe[0], F_SETFD, FD_CLOEXEC);
 
+               /*
+                * Change the name of this process not to confuse --exclude-perf users
+                * that sees 'perf' in the window up to the execvp() and thinks that
+                * perf samples are not being excluded.
+                */
+               prctl(PR_SET_NAME, "perf-exec");
+
                /*
                 * Tell the parent we're ready to go
                 */