perf evlist: Change the COMM when preparing the workload
[linux-2.6-microblaze.git] / tools / perf / util / evlist.c
index 882cd1f..435bbfd 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>
@@ -1405,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
                 */