aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@gmail.com>2012-07-20 19:25:47 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-07-25 10:27:55 -0400
commit5cd95c2db479aa7a66f6fa572dfa410c6314c78e (patch)
treeff169d69984b54677b26092df96df74f8144f593 /tools
parentf51304d3fe4fee475991ee424a4b7f85eec65a7b (diff)
perf kvm: Set name for VM process in guest machine
COMM events are not generated in the context of a guest machine, so the thread name is never set for the VMM process. For example, the qemu-kvm name applies to the process in the host machine, not the guest machine. So, samples for guest machines are currently displayed as: 99.67% :5671 [unknown] [g] 0xffffffff81366b41 where 5671 is the pid of the VMM. With this patch the samples in the guest machine are shown as: 18.43% [guest/5671] [unknown] [g] 0xffffffff810d68b7 Tested-by: Jiri Olsa <jolsa@redhat.com> Signed-off-by: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1342826756-64663-3-git-send-email-dsahern@gmail.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/map.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
index a1f4e3669142..8668569d4b2a 100644
--- a/tools/perf/util/map.c
+++ b/tools/perf/util/map.c
@@ -7,6 +7,7 @@
7#include <stdio.h> 7#include <stdio.h>
8#include <unistd.h> 8#include <unistd.h>
9#include "map.h" 9#include "map.h"
10#include "thread.h"
10 11
11const char *map_type__name[MAP__NR_TYPES] = { 12const char *map_type__name[MAP__NR_TYPES] = {
12 [MAP__FUNCTION] = "Functions", 13 [MAP__FUNCTION] = "Functions",
@@ -585,7 +586,21 @@ int machine__init(struct machine *self, const char *root_dir, pid_t pid)
585 self->kmaps.machine = self; 586 self->kmaps.machine = self;
586 self->pid = pid; 587 self->pid = pid;
587 self->root_dir = strdup(root_dir); 588 self->root_dir = strdup(root_dir);
588 return self->root_dir == NULL ? -ENOMEM : 0; 589 if (self->root_dir == NULL)
590 return -ENOMEM;
591
592 if (pid != HOST_KERNEL_ID) {
593 struct thread *thread = machine__findnew_thread(self, pid);
594 char comm[64];
595
596 if (thread == NULL)
597 return -ENOMEM;
598
599 snprintf(comm, sizeof(comm), "[guest/%d]", pid);
600 thread__set_comm(thread, comm);
601 }
602
603 return 0;
589} 604}
590 605
591static void dsos__delete(struct list_head *self) 606static void dsos__delete(struct list_head *self)