perf tools: Use machine->pid for tgid if machine is guest.
authorDongsheng Yang <yangds.fnst@cn.fujitsu.com>
Fri, 20 Dec 2013 20:52:59 +0000 (15:52 -0500)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 23 Dec 2013 19:49:50 +0000 (16:49 -0300)
When we synthesize an comm event, if machine is guest, we should
use the pid of machine as the event->comm.pid, rather than tgid
of thread.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Link: http://lkml.kernel.org/r/22455abe107c618a361e7b667ad0f098f7c9b4a3.1387572416.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/event.c

index 07c07833de53a2b6063880af4314038f3b5d57b7..2905771a1f494ac7c65aa605c6fd2b62a60025ca 100644 (file)
@@ -106,8 +106,12 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
 
        memset(&event->comm, 0, sizeof(event->comm));
 
-       tgid = perf_event__get_comm_tgid(pid, event->comm.comm,
-                                        sizeof(event->comm.comm));
+       if (machine__is_host(machine))
+               tgid = perf_event__get_comm_tgid(pid, event->comm.comm,
+                                                sizeof(event->comm.comm));
+       else
+               tgid = machine->pid;
+
        if (tgid < 0)
                goto out;