diff options
author | Dongsheng Yang <yangds.fnst@cn.fujitsu.com> | 2013-12-20 15:52:57 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-23 14:49:49 -0500 |
commit | 995634650ef1f907196bd7e9ae45354124a80e47 (patch) | |
tree | b7f00fda7bb4155f3f2c5177cac13017d2d5143b /tools/perf | |
parent | fb50bb43d051d12aad9e2337d0d5d14d0d3dd281 (diff) |
perf tools: Find the proc info under machine->root_dir.
When we synthesize the threads, we are looking for the infomation under
/proc. But it is only for host.
This patch look for the path of proc under machine->root_dir, then
XXX__synthesize_threads() functions can support guest machines.
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/927b937da9177a079abafe4532fa9c9b60b5c4b7.1387572416.git.yangds.fnst@cn.fujitsu.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/event.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 484e99464a00..a61726ea01a9 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -129,7 +129,8 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool, | |||
129 | goto out; | 129 | goto out; |
130 | } | 130 | } |
131 | 131 | ||
132 | snprintf(filename, sizeof(filename), "/proc/%d/task", pid); | 132 | snprintf(filename, sizeof(filename), "%s/proc/%d/task", |
133 | machine->root_dir, pid); | ||
133 | 134 | ||
134 | tasks = opendir(filename); | 135 | tasks = opendir(filename); |
135 | if (tasks == NULL) { | 136 | if (tasks == NULL) { |
@@ -178,7 +179,8 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
178 | FILE *fp; | 179 | FILE *fp; |
179 | int rc = 0; | 180 | int rc = 0; |
180 | 181 | ||
181 | snprintf(filename, sizeof(filename), "/proc/%d/maps", pid); | 182 | snprintf(filename, sizeof(filename), "%s/proc/%d/maps", |
183 | machine->root_dir, pid); | ||
182 | 184 | ||
183 | fp = fopen(filename, "r"); | 185 | fp = fopen(filename, "r"); |
184 | if (fp == NULL) { | 186 | if (fp == NULL) { |
@@ -387,6 +389,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool, | |||
387 | struct machine *machine, bool mmap_data) | 389 | struct machine *machine, bool mmap_data) |
388 | { | 390 | { |
389 | DIR *proc; | 391 | DIR *proc; |
392 | char proc_path[PATH_MAX]; | ||
390 | struct dirent dirent, *next; | 393 | struct dirent dirent, *next; |
391 | union perf_event *comm_event, *mmap_event; | 394 | union perf_event *comm_event, *mmap_event; |
392 | int err = -1; | 395 | int err = -1; |
@@ -399,7 +402,9 @@ int perf_event__synthesize_threads(struct perf_tool *tool, | |||
399 | if (mmap_event == NULL) | 402 | if (mmap_event == NULL) |
400 | goto out_free_comm; | 403 | goto out_free_comm; |
401 | 404 | ||
402 | proc = opendir("/proc"); | 405 | snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir); |
406 | proc = opendir(proc_path); | ||
407 | |||
403 | if (proc == NULL) | 408 | if (proc == NULL) |
404 | goto out_free_mmap; | 409 | goto out_free_mmap; |
405 | 410 | ||