Commit 99563465 authored by Dongsheng Yang's avatar Dongsheng Yang Committed by Arnaldo Carvalho de Melo

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: default avatarDongsheng 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent fb50bb43
...@@ -129,7 +129,8 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool, ...@@ -129,7 +129,8 @@ static pid_t perf_event__synthesize_comm(struct perf_tool *tool,
goto out; goto out;
} }
snprintf(filename, sizeof(filename), "/proc/%d/task", pid); snprintf(filename, sizeof(filename), "%s/proc/%d/task",
machine->root_dir, pid);
tasks = opendir(filename); tasks = opendir(filename);
if (tasks == NULL) { if (tasks == NULL) {
...@@ -178,7 +179,8 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool, ...@@ -178,7 +179,8 @@ static int perf_event__synthesize_mmap_events(struct perf_tool *tool,
FILE *fp; FILE *fp;
int rc = 0; int rc = 0;
snprintf(filename, sizeof(filename), "/proc/%d/maps", pid); snprintf(filename, sizeof(filename), "%s/proc/%d/maps",
machine->root_dir, pid);
fp = fopen(filename, "r"); fp = fopen(filename, "r");
if (fp == NULL) { if (fp == NULL) {
...@@ -387,6 +389,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool, ...@@ -387,6 +389,7 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
struct machine *machine, bool mmap_data) struct machine *machine, bool mmap_data)
{ {
DIR *proc; DIR *proc;
char proc_path[PATH_MAX];
struct dirent dirent, *next; struct dirent dirent, *next;
union perf_event *comm_event, *mmap_event; union perf_event *comm_event, *mmap_event;
int err = -1; int err = -1;
...@@ -399,7 +402,9 @@ int perf_event__synthesize_threads(struct perf_tool *tool, ...@@ -399,7 +402,9 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
if (mmap_event == NULL) if (mmap_event == NULL)
goto out_free_comm; goto out_free_comm;
proc = opendir("/proc"); snprintf(proc_path, sizeof(proc_path), "%s/proc", machine->root_dir);
proc = opendir(proc_path);
if (proc == NULL) if (proc == NULL)
goto out_free_mmap; goto out_free_mmap;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment