|
@@ -213,19 +213,19 @@ static int perf_event__synthesize_fork(struct perf_tool *tool,
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
-#define PROC_MAP_PARSE_TIMEOUT (500 * 1000000ULL)
|
|
|
|
-
|
|
|
|
int perf_event__synthesize_mmap_events(struct perf_tool *tool,
|
|
int perf_event__synthesize_mmap_events(struct perf_tool *tool,
|
|
union perf_event *event,
|
|
union perf_event *event,
|
|
pid_t pid, pid_t tgid,
|
|
pid_t pid, pid_t tgid,
|
|
perf_event__handler_t process,
|
|
perf_event__handler_t process,
|
|
struct machine *machine,
|
|
struct machine *machine,
|
|
- bool mmap_data)
|
|
|
|
|
|
+ bool mmap_data,
|
|
|
|
+ unsigned int proc_map_timeout)
|
|
{
|
|
{
|
|
char filename[PATH_MAX];
|
|
char filename[PATH_MAX];
|
|
FILE *fp;
|
|
FILE *fp;
|
|
unsigned long long t;
|
|
unsigned long long t;
|
|
bool truncation = false;
|
|
bool truncation = false;
|
|
|
|
+ unsigned long long timeout = proc_map_timeout * 1000000ULL;
|
|
int rc = 0;
|
|
int rc = 0;
|
|
|
|
|
|
if (machine__is_default_guest(machine))
|
|
if (machine__is_default_guest(machine))
|
|
@@ -258,8 +258,11 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,
|
|
if (fgets(bf, sizeof(bf), fp) == NULL)
|
|
if (fgets(bf, sizeof(bf), fp) == NULL)
|
|
break;
|
|
break;
|
|
|
|
|
|
- if ((rdclock() - t) > PROC_MAP_PARSE_TIMEOUT) {
|
|
|
|
- pr_warning("Reading %s time out.\n", filename);
|
|
|
|
|
|
+ if ((rdclock() - t) > timeout) {
|
|
|
|
+ pr_warning("Reading %s time out. "
|
|
|
|
+ "You may want to increase "
|
|
|
|
+ "the time limit by --proc-map-timeout\n",
|
|
|
|
+ filename);
|
|
truncation = true;
|
|
truncation = true;
|
|
goto out;
|
|
goto out;
|
|
}
|
|
}
|
|
@@ -404,7 +407,9 @@ static int __event__synthesize_thread(union perf_event *comm_event,
|
|
pid_t pid, int full,
|
|
pid_t pid, int full,
|
|
perf_event__handler_t process,
|
|
perf_event__handler_t process,
|
|
struct perf_tool *tool,
|
|
struct perf_tool *tool,
|
|
- struct machine *machine, bool mmap_data)
|
|
|
|
|
|
+ struct machine *machine,
|
|
|
|
+ bool mmap_data,
|
|
|
|
+ unsigned int proc_map_timeout)
|
|
{
|
|
{
|
|
char filename[PATH_MAX];
|
|
char filename[PATH_MAX];
|
|
DIR *tasks;
|
|
DIR *tasks;
|
|
@@ -421,7 +426,8 @@ static int __event__synthesize_thread(union perf_event *comm_event,
|
|
return -1;
|
|
return -1;
|
|
|
|
|
|
return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
|
|
return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
|
|
- process, machine, mmap_data);
|
|
|
|
|
|
+ process, machine, mmap_data,
|
|
|
|
+ proc_map_timeout);
|
|
}
|
|
}
|
|
|
|
|
|
if (machine__is_default_guest(machine))
|
|
if (machine__is_default_guest(machine))
|
|
@@ -462,7 +468,7 @@ static int __event__synthesize_thread(union perf_event *comm_event,
|
|
if (_pid == pid) {
|
|
if (_pid == pid) {
|
|
/* process the parent's maps too */
|
|
/* process the parent's maps too */
|
|
rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
|
|
rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid,
|
|
- process, machine, mmap_data);
|
|
|
|
|
|
+ process, machine, mmap_data, proc_map_timeout);
|
|
if (rc)
|
|
if (rc)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -476,7 +482,8 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
|
struct thread_map *threads,
|
|
struct thread_map *threads,
|
|
perf_event__handler_t process,
|
|
perf_event__handler_t process,
|
|
struct machine *machine,
|
|
struct machine *machine,
|
|
- bool mmap_data)
|
|
|
|
|
|
+ bool mmap_data,
|
|
|
|
+ unsigned int proc_map_timeout)
|
|
{
|
|
{
|
|
union perf_event *comm_event, *mmap_event, *fork_event;
|
|
union perf_event *comm_event, *mmap_event, *fork_event;
|
|
int err = -1, thread, j;
|
|
int err = -1, thread, j;
|
|
@@ -499,7 +506,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
|
fork_event,
|
|
fork_event,
|
|
threads->map[thread], 0,
|
|
threads->map[thread], 0,
|
|
process, tool, machine,
|
|
process, tool, machine,
|
|
- mmap_data)) {
|
|
|
|
|
|
+ mmap_data, proc_map_timeout)) {
|
|
err = -1;
|
|
err = -1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -525,7 +532,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool,
|
|
fork_event,
|
|
fork_event,
|
|
comm_event->comm.pid, 0,
|
|
comm_event->comm.pid, 0,
|
|
process, tool, machine,
|
|
process, tool, machine,
|
|
- mmap_data)) {
|
|
|
|
|
|
+ mmap_data, proc_map_timeout)) {
|
|
err = -1;
|
|
err = -1;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -542,7 +549,9 @@ out:
|
|
|
|
|
|
int perf_event__synthesize_threads(struct perf_tool *tool,
|
|
int perf_event__synthesize_threads(struct perf_tool *tool,
|
|
perf_event__handler_t process,
|
|
perf_event__handler_t process,
|
|
- struct machine *machine, bool mmap_data)
|
|
|
|
|
|
+ struct machine *machine,
|
|
|
|
+ bool mmap_data,
|
|
|
|
+ unsigned int proc_map_timeout)
|
|
{
|
|
{
|
|
DIR *proc;
|
|
DIR *proc;
|
|
char proc_path[PATH_MAX];
|
|
char proc_path[PATH_MAX];
|
|
@@ -582,7 +591,8 @@ int perf_event__synthesize_threads(struct perf_tool *tool,
|
|
* one thread couldn't be synthesized.
|
|
* one thread couldn't be synthesized.
|
|
*/
|
|
*/
|
|
__event__synthesize_thread(comm_event, mmap_event, fork_event, pid,
|
|
__event__synthesize_thread(comm_event, mmap_event, fork_event, pid,
|
|
- 1, process, tool, machine, mmap_data);
|
|
|
|
|
|
+ 1, process, tool, machine, mmap_data,
|
|
|
|
+ proc_map_timeout);
|
|
}
|
|
}
|
|
|
|
|
|
err = 0;
|
|
err = 0;
|