diff options
author | Kan Liang <kan.liang@intel.com> | 2015-06-17 09:51:11 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-06-19 17:27:13 -0400 |
commit | 9d9cad763ca79dd3697e9f2d1df648e37496582b (patch) | |
tree | f59dd3c9d866c2fa8aa85b90c1eac83bf4f515a9 /tools/perf | |
parent | 930e6fcd2bcce9bcd9d4aa7e755678d33f3fe6f4 (diff) |
perf tools: Configurable per thread proc map processing time out
The time out to limit the individual proc map processing was hard code
to 500ms. This patch introduce a new option --proc-map-timeout to make
the time limit configurable.
Signed-off-by: Kan Liang <kan.liang@intel.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Ying Huang <ying.huang@intel.com>
Link: http://lkml.kernel.org/r/1434549071-25611-2-git-send-email-kan.liang@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/Documentation/perf-kvm.txt | 6 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-record.txt | 5 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-top.txt | 6 | ||||
-rw-r--r-- | tools/perf/Documentation/perf-trace.txt | 5 | ||||
-rw-r--r-- | tools/perf/builtin-kvm.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-record.c | 6 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 5 | ||||
-rw-r--r-- | tools/perf/builtin-trace.c | 6 | ||||
-rw-r--r-- | tools/perf/perf.h | 1 | ||||
-rw-r--r-- | tools/perf/tests/code-reading.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/dwarf-unwind.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/mmap-thread-lookup.c | 4 | ||||
-rw-r--r-- | tools/perf/util/event.c | 36 | ||||
-rw-r--r-- | tools/perf/util/event.h | 9 | ||||
-rw-r--r-- | tools/perf/util/machine.c | 7 | ||||
-rw-r--r-- | tools/perf/util/machine.h | 9 | ||||
-rw-r--r-- | tools/perf/util/session.c | 4 |
17 files changed, 87 insertions, 31 deletions
diff --git a/tools/perf/Documentation/perf-kvm.txt b/tools/perf/Documentation/perf-kvm.txt index 6252e776009c..6a5bb2b17039 100644 --- a/tools/perf/Documentation/perf-kvm.txt +++ b/tools/perf/Documentation/perf-kvm.txt | |||
@@ -151,6 +151,12 @@ STAT LIVE OPTIONS | |||
151 | Show events other than HLT (x86 only) or Wait state (s390 only) | 151 | Show events other than HLT (x86 only) or Wait state (s390 only) |
152 | that take longer than duration usecs. | 152 | that take longer than duration usecs. |
153 | 153 | ||
154 | --proc-map-timeout:: | ||
155 | When processing pre-existing threads /proc/XXX/mmap, it may take | ||
156 | a long time, because the file may be huge. A time out is needed | ||
157 | in such cases. | ||
158 | This option sets the time out limit. The default value is 500 ms. | ||
159 | |||
154 | SEE ALSO | 160 | SEE ALSO |
155 | -------- | 161 | -------- |
156 | linkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1], | 162 | linkperf:perf-top[1], linkperf:perf-record[1], linkperf:perf-report[1], |
diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt index 6fdf78625c51..9b9d9d086680 100644 --- a/tools/perf/Documentation/perf-record.txt +++ b/tools/perf/Documentation/perf-record.txt | |||
@@ -271,6 +271,11 @@ AUX area tracing event. Optionally the number of bytes to capture per | |||
271 | snapshot can be specified. In Snapshot Mode, trace data is captured only when | 271 | snapshot can be specified. In Snapshot Mode, trace data is captured only when |
272 | signal SIGUSR2 is received. | 272 | signal SIGUSR2 is received. |
273 | 273 | ||
274 | --proc-map-timeout:: | ||
275 | When processing pre-existing threads /proc/XXX/mmap, it may take a long time, | ||
276 | because the file may be huge. A time out is needed in such cases. | ||
277 | This option sets the time out limit. The default value is 500 ms. | ||
278 | |||
274 | SEE ALSO | 279 | SEE ALSO |
275 | -------- | 280 | -------- |
276 | linkperf:perf-stat[1], linkperf:perf-list[1] | 281 | linkperf:perf-stat[1], linkperf:perf-list[1] |
diff --git a/tools/perf/Documentation/perf-top.txt b/tools/perf/Documentation/perf-top.txt index 9e5b07eb7d35..776aec4d0927 100644 --- a/tools/perf/Documentation/perf-top.txt +++ b/tools/perf/Documentation/perf-top.txt | |||
@@ -201,6 +201,12 @@ Default is to monitor all CPUS. | |||
201 | Force each column width to the provided list, for large terminal | 201 | Force each column width to the provided list, for large terminal |
202 | readability. 0 means no limit (default behavior). | 202 | readability. 0 means no limit (default behavior). |
203 | 203 | ||
204 | --proc-map-timeout:: | ||
205 | When processing pre-existing threads /proc/XXX/mmap, it may take | ||
206 | a long time, because the file may be huge. A time out is needed | ||
207 | in such cases. | ||
208 | This option sets the time out limit. The default value is 500 ms. | ||
209 | |||
204 | 210 | ||
205 | INTERACTIVE PROMPTING KEYS | 211 | INTERACTIVE PROMPTING KEYS |
206 | -------------------------- | 212 | -------------------------- |
diff --git a/tools/perf/Documentation/perf-trace.txt b/tools/perf/Documentation/perf-trace.txt index 1db9c8b79880..7ea078658a87 100644 --- a/tools/perf/Documentation/perf-trace.txt +++ b/tools/perf/Documentation/perf-trace.txt | |||
@@ -121,6 +121,11 @@ the thread executes on the designated CPUs. Default is to monitor all CPUs. | |||
121 | --event:: | 121 | --event:: |
122 | Trace other events, see 'perf list' for a complete list. | 122 | Trace other events, see 'perf list' for a complete list. |
123 | 123 | ||
124 | --proc-map-timeout:: | ||
125 | When processing pre-existing threads /proc/XXX/mmap, it may take a long time, | ||
126 | because the file may be huge. A time out is needed in such cases. | ||
127 | This option sets the time out limit. The default value is 500 ms. | ||
128 | |||
124 | PAGEFAULTS | 129 | PAGEFAULTS |
125 | ---------- | 130 | ---------- |
126 | 131 | ||
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 15fecd3dc5d8..74878cd75078 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
@@ -1311,6 +1311,8 @@ static int kvm_events_live(struct perf_kvm_stat *kvm, | |||
1311 | "show events other than" | 1311 | "show events other than" |
1312 | " HLT (x86 only) or Wait state (s390 only)" | 1312 | " HLT (x86 only) or Wait state (s390 only)" |
1313 | " that take longer than duration usecs"), | 1313 | " that take longer than duration usecs"), |
1314 | OPT_UINTEGER(0, "proc-map-timeout", &kvm->opts.proc_map_timeout, | ||
1315 | "per thread proc mmap processing timeout in ms"), | ||
1314 | OPT_END() | 1316 | OPT_END() |
1315 | }; | 1317 | }; |
1316 | const char * const live_usage[] = { | 1318 | const char * const live_usage[] = { |
@@ -1338,6 +1340,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm, | |||
1338 | kvm->opts.target.uses_mmap = false; | 1340 | kvm->opts.target.uses_mmap = false; |
1339 | kvm->opts.target.uid_str = NULL; | 1341 | kvm->opts.target.uid_str = NULL; |
1340 | kvm->opts.target.uid = UINT_MAX; | 1342 | kvm->opts.target.uid = UINT_MAX; |
1343 | kvm->opts.proc_map_timeout = 500; | ||
1341 | 1344 | ||
1342 | symbol__init(NULL); | 1345 | symbol__init(NULL); |
1343 | disable_buildid_cache(); | 1346 | disable_buildid_cache(); |
@@ -1393,7 +1396,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm, | |||
1393 | perf_session__set_id_hdr_size(kvm->session); | 1396 | perf_session__set_id_hdr_size(kvm->session); |
1394 | ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true); | 1397 | ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true); |
1395 | machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target, | 1398 | machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target, |
1396 | kvm->evlist->threads, false); | 1399 | kvm->evlist->threads, false, kvm->opts.proc_map_timeout); |
1397 | err = kvm_live_open_events(kvm); | 1400 | err = kvm_live_open_events(kvm); |
1398 | if (err) | 1401 | if (err) |
1399 | goto out; | 1402 | goto out; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 4d6cdeb94fe1..de165a1b9240 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -598,7 +598,8 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
598 | } | 598 | } |
599 | 599 | ||
600 | err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads, | 600 | err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads, |
601 | process_synthesized_event, opts->sample_address); | 601 | process_synthesized_event, opts->sample_address, |
602 | opts->proc_map_timeout); | ||
602 | if (err != 0) | 603 | if (err != 0) |
603 | goto out_child; | 604 | goto out_child; |
604 | 605 | ||
@@ -959,6 +960,7 @@ static struct record record = { | |||
959 | .uses_mmap = true, | 960 | .uses_mmap = true, |
960 | .default_per_cpu = true, | 961 | .default_per_cpu = true, |
961 | }, | 962 | }, |
963 | .proc_map_timeout = 500, | ||
962 | }, | 964 | }, |
963 | .tool = { | 965 | .tool = { |
964 | .sample = process_sample_event, | 966 | .sample = process_sample_event, |
@@ -1066,6 +1068,8 @@ struct option __record_options[] = { | |||
1066 | parse_clockid), | 1068 | parse_clockid), |
1067 | OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts, | 1069 | OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts, |
1068 | "opts", "AUX area tracing Snapshot Mode", ""), | 1070 | "opts", "AUX area tracing Snapshot Mode", ""), |
1071 | OPT_UINTEGER(0, "proc-map-timeout", &record.opts.proc_map_timeout, | ||
1072 | "per thread proc mmap processing timeout in ms"), | ||
1069 | OPT_END() | 1073 | OPT_END() |
1070 | }; | 1074 | }; |
1071 | 1075 | ||
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 70a9505aae83..619a8696fda7 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -977,7 +977,7 @@ static int __cmd_top(struct perf_top *top) | |||
977 | goto out_delete; | 977 | goto out_delete; |
978 | 978 | ||
979 | machine__synthesize_threads(&top->session->machines.host, &opts->target, | 979 | machine__synthesize_threads(&top->session->machines.host, &opts->target, |
980 | top->evlist->threads, false); | 980 | top->evlist->threads, false, opts->proc_map_timeout); |
981 | ret = perf_top__start_counters(top); | 981 | ret = perf_top__start_counters(top); |
982 | if (ret) | 982 | if (ret) |
983 | goto out_delete; | 983 | goto out_delete; |
@@ -1087,6 +1087,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1087 | .target = { | 1087 | .target = { |
1088 | .uses_mmap = true, | 1088 | .uses_mmap = true, |
1089 | }, | 1089 | }, |
1090 | .proc_map_timeout = 500, | ||
1090 | }, | 1091 | }, |
1091 | .max_stack = PERF_MAX_STACK_DEPTH, | 1092 | .max_stack = PERF_MAX_STACK_DEPTH, |
1092 | .sym_pcnt_filter = 5, | 1093 | .sym_pcnt_filter = 5, |
@@ -1186,6 +1187,8 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1186 | OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str, | 1187 | OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str, |
1187 | "width[,width...]", | 1188 | "width[,width...]", |
1188 | "don't try to adjust column width, use these fixed values"), | 1189 | "don't try to adjust column width, use these fixed values"), |
1190 | OPT_UINTEGER(0, "proc-map-timeout", &opts->proc_map_timeout, | ||
1191 | "per thread proc mmap processing timeout in ms"), | ||
1189 | OPT_END() | 1192 | OPT_END() |
1190 | }; | 1193 | }; |
1191 | const char * const top_usage[] = { | 1194 | const char * const top_usage[] = { |
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c index 4bf805b2fbf6..de5d277d1ad7 100644 --- a/tools/perf/builtin-trace.c +++ b/tools/perf/builtin-trace.c | |||
@@ -1518,7 +1518,8 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist) | |||
1518 | return -ENOMEM; | 1518 | return -ENOMEM; |
1519 | 1519 | ||
1520 | err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target, | 1520 | err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target, |
1521 | evlist->threads, trace__tool_process, false); | 1521 | evlist->threads, trace__tool_process, false, |
1522 | trace->opts.proc_map_timeout); | ||
1522 | if (err) | 1523 | if (err) |
1523 | symbol__exit(); | 1524 | symbol__exit(); |
1524 | 1525 | ||
@@ -2747,6 +2748,7 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2747 | .user_interval = ULLONG_MAX, | 2748 | .user_interval = ULLONG_MAX, |
2748 | .no_buffering = true, | 2749 | .no_buffering = true, |
2749 | .mmap_pages = UINT_MAX, | 2750 | .mmap_pages = UINT_MAX, |
2751 | .proc_map_timeout = 500, | ||
2750 | }, | 2752 | }, |
2751 | .output = stdout, | 2753 | .output = stdout, |
2752 | .show_comm = true, | 2754 | .show_comm = true, |
@@ -2796,6 +2798,8 @@ int cmd_trace(int argc, const char **argv, const char *prefix __maybe_unused) | |||
2796 | "Trace pagefaults", parse_pagefaults, "maj"), | 2798 | "Trace pagefaults", parse_pagefaults, "maj"), |
2797 | OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"), | 2799 | OPT_BOOLEAN(0, "syscalls", &trace.trace_syscalls, "Trace syscalls"), |
2798 | OPT_BOOLEAN('f', "force", &trace.force, "don't complain, do it"), | 2800 | OPT_BOOLEAN('f', "force", &trace.force, "don't complain, do it"), |
2801 | OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout, | ||
2802 | "per thread proc mmap processing timeout in ms"), | ||
2799 | OPT_END() | 2803 | OPT_END() |
2800 | }; | 2804 | }; |
2801 | const char * const trace_subcommands[] = { "record", NULL }; | 2805 | const char * const trace_subcommands[] = { "record", NULL }; |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index aa79fb8a16d4..4a5827fff799 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -69,6 +69,7 @@ struct record_opts { | |||
69 | unsigned initial_delay; | 69 | unsigned initial_delay; |
70 | bool use_clockid; | 70 | bool use_clockid; |
71 | clockid_t clockid; | 71 | clockid_t clockid; |
72 | unsigned int proc_map_timeout; | ||
72 | }; | 73 | }; |
73 | 74 | ||
74 | struct option; | 75 | struct option; |
diff --git a/tools/perf/tests/code-reading.c b/tools/perf/tests/code-reading.c index e2a432b67d52..22f8a00446e1 100644 --- a/tools/perf/tests/code-reading.c +++ b/tools/perf/tests/code-reading.c | |||
@@ -451,7 +451,7 @@ static int do_test_code_reading(bool try_kcore) | |||
451 | } | 451 | } |
452 | 452 | ||
453 | ret = perf_event__synthesize_thread_map(NULL, threads, | 453 | ret = perf_event__synthesize_thread_map(NULL, threads, |
454 | perf_event__process, machine, false); | 454 | perf_event__process, machine, false, 500); |
455 | if (ret < 0) { | 455 | if (ret < 0) { |
456 | pr_debug("perf_event__synthesize_thread_map failed\n"); | 456 | pr_debug("perf_event__synthesize_thread_map failed\n"); |
457 | goto out_err; | 457 | goto out_err; |
diff --git a/tools/perf/tests/dwarf-unwind.c b/tools/perf/tests/dwarf-unwind.c index 9b748e1ad46e..40b36c462427 100644 --- a/tools/perf/tests/dwarf-unwind.c +++ b/tools/perf/tests/dwarf-unwind.c | |||
@@ -28,7 +28,7 @@ static int init_live_machine(struct machine *machine) | |||
28 | pid_t pid = getpid(); | 28 | pid_t pid = getpid(); |
29 | 29 | ||
30 | return perf_event__synthesize_mmap_events(NULL, &event, pid, pid, | 30 | return perf_event__synthesize_mmap_events(NULL, &event, pid, pid, |
31 | mmap_handler, machine, true); | 31 | mmap_handler, machine, true, 500); |
32 | } | 32 | } |
33 | 33 | ||
34 | #define MAX_STACK 8 | 34 | #define MAX_STACK 8 |
diff --git a/tools/perf/tests/mmap-thread-lookup.c b/tools/perf/tests/mmap-thread-lookup.c index 264e215c0d36..7f48efa7e295 100644 --- a/tools/perf/tests/mmap-thread-lookup.c +++ b/tools/perf/tests/mmap-thread-lookup.c | |||
@@ -129,7 +129,7 @@ static int synth_all(struct machine *machine) | |||
129 | { | 129 | { |
130 | return perf_event__synthesize_threads(NULL, | 130 | return perf_event__synthesize_threads(NULL, |
131 | perf_event__process, | 131 | perf_event__process, |
132 | machine, 0); | 132 | machine, 0, 500); |
133 | } | 133 | } |
134 | 134 | ||
135 | static int synth_process(struct machine *machine) | 135 | static int synth_process(struct machine *machine) |
@@ -141,7 +141,7 @@ static int synth_process(struct machine *machine) | |||
141 | 141 | ||
142 | err = perf_event__synthesize_thread_map(NULL, map, | 142 | err = perf_event__synthesize_thread_map(NULL, map, |
143 | perf_event__process, | 143 | perf_event__process, |
144 | machine, 0); | 144 | machine, 0, 500); |
145 | 145 | ||
146 | thread_map__delete(map); | 146 | thread_map__delete(map); |
147 | return err; | 147 | return err; |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 416ba80c628f..d7d986d8f23e 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -213,19 +213,19 @@ static int perf_event__synthesize_fork(struct perf_tool *tool, | |||
213 | return 0; | 213 | return 0; |
214 | } | 214 | } |
215 | 215 | ||
216 | #define PROC_MAP_PARSE_TIMEOUT (500 * 1000000ULL) | ||
217 | |||
218 | int perf_event__synthesize_mmap_events(struct perf_tool *tool, | 216 | int perf_event__synthesize_mmap_events(struct perf_tool *tool, |
219 | union perf_event *event, | 217 | union perf_event *event, |
220 | pid_t pid, pid_t tgid, | 218 | pid_t pid, pid_t tgid, |
221 | perf_event__handler_t process, | 219 | perf_event__handler_t process, |
222 | struct machine *machine, | 220 | struct machine *machine, |
223 | bool mmap_data) | 221 | bool mmap_data, |
222 | unsigned int proc_map_timeout) | ||
224 | { | 223 | { |
225 | char filename[PATH_MAX]; | 224 | char filename[PATH_MAX]; |
226 | FILE *fp; | 225 | FILE *fp; |
227 | unsigned long long t; | 226 | unsigned long long t; |
228 | bool truncation = false; | 227 | bool truncation = false; |
228 | unsigned long long timeout = proc_map_timeout * 1000000ULL; | ||
229 | int rc = 0; | 229 | int rc = 0; |
230 | 230 | ||
231 | if (machine__is_default_guest(machine)) | 231 | if (machine__is_default_guest(machine)) |
@@ -258,8 +258,11 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
258 | if (fgets(bf, sizeof(bf), fp) == NULL) | 258 | if (fgets(bf, sizeof(bf), fp) == NULL) |
259 | break; | 259 | break; |
260 | 260 | ||
261 | if ((rdclock() - t) > PROC_MAP_PARSE_TIMEOUT) { | 261 | if ((rdclock() - t) > timeout) { |
262 | pr_warning("Reading %s time out.\n", filename); | 262 | pr_warning("Reading %s time out. " |
263 | "You may want to increase " | ||
264 | "the time limit by --proc-map-timeout\n", | ||
265 | filename); | ||
263 | truncation = true; | 266 | truncation = true; |
264 | goto out; | 267 | goto out; |
265 | } | 268 | } |
@@ -404,7 +407,9 @@ static int __event__synthesize_thread(union perf_event *comm_event, | |||
404 | pid_t pid, int full, | 407 | pid_t pid, int full, |
405 | perf_event__handler_t process, | 408 | perf_event__handler_t process, |
406 | struct perf_tool *tool, | 409 | struct perf_tool *tool, |
407 | struct machine *machine, bool mmap_data) | 410 | struct machine *machine, |
411 | bool mmap_data, | ||
412 | unsigned int proc_map_timeout) | ||
408 | { | 413 | { |
409 | char filename[PATH_MAX]; | 414 | char filename[PATH_MAX]; |
410 | DIR *tasks; | 415 | DIR *tasks; |
@@ -421,7 +426,8 @@ static int __event__synthesize_thread(union perf_event *comm_event, | |||
421 | return -1; | 426 | return -1; |
422 | 427 | ||
423 | return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, | 428 | return perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, |
424 | process, machine, mmap_data); | 429 | process, machine, mmap_data, |
430 | proc_map_timeout); | ||
425 | } | 431 | } |
426 | 432 | ||
427 | if (machine__is_default_guest(machine)) | 433 | if (machine__is_default_guest(machine)) |
@@ -462,7 +468,7 @@ static int __event__synthesize_thread(union perf_event *comm_event, | |||
462 | if (_pid == pid) { | 468 | if (_pid == pid) { |
463 | /* process the parent's maps too */ | 469 | /* process the parent's maps too */ |
464 | rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, | 470 | rc = perf_event__synthesize_mmap_events(tool, mmap_event, pid, tgid, |
465 | process, machine, mmap_data); | 471 | process, machine, mmap_data, proc_map_timeout); |
466 | if (rc) | 472 | if (rc) |
467 | break; | 473 | break; |
468 | } | 474 | } |
@@ -476,7 +482,8 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, | |||
476 | struct thread_map *threads, | 482 | struct thread_map *threads, |
477 | perf_event__handler_t process, | 483 | perf_event__handler_t process, |
478 | struct machine *machine, | 484 | struct machine *machine, |
479 | bool mmap_data) | 485 | bool mmap_data, |
486 | unsigned int proc_map_timeout) | ||
480 | { | 487 | { |
481 | union perf_event *comm_event, *mmap_event, *fork_event; | 488 | union perf_event *comm_event, *mmap_event, *fork_event; |
482 | int err = -1, thread, j; | 489 | int err = -1, thread, j; |
@@ -499,7 +506,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, | |||
499 | fork_event, | 506 | fork_event, |
500 | threads->map[thread], 0, | 507 | threads->map[thread], 0, |
501 | process, tool, machine, | 508 | process, tool, machine, |
502 | mmap_data)) { | 509 | mmap_data, proc_map_timeout)) { |
503 | err = -1; | 510 | err = -1; |
504 | break; | 511 | break; |
505 | } | 512 | } |
@@ -525,7 +532,7 @@ int perf_event__synthesize_thread_map(struct perf_tool *tool, | |||
525 | fork_event, | 532 | fork_event, |
526 | comm_event->comm.pid, 0, | 533 | comm_event->comm.pid, 0, |
527 | process, tool, machine, | 534 | process, tool, machine, |
528 | mmap_data)) { | 535 | mmap_data, proc_map_timeout)) { |
529 | err = -1; | 536 | err = -1; |
530 | break; | 537 | break; |
531 | } | 538 | } |
@@ -542,7 +549,9 @@ out: | |||
542 | 549 | ||
543 | int perf_event__synthesize_threads(struct perf_tool *tool, | 550 | int perf_event__synthesize_threads(struct perf_tool *tool, |
544 | perf_event__handler_t process, | 551 | perf_event__handler_t process, |
545 | struct machine *machine, bool mmap_data) | 552 | struct machine *machine, |
553 | bool mmap_data, | ||
554 | unsigned int proc_map_timeout) | ||
546 | { | 555 | { |
547 | DIR *proc; | 556 | DIR *proc; |
548 | char proc_path[PATH_MAX]; | 557 | char proc_path[PATH_MAX]; |
@@ -582,7 +591,8 @@ int perf_event__synthesize_threads(struct perf_tool *tool, | |||
582 | * one thread couldn't be synthesized. | 591 | * one thread couldn't be synthesized. |
583 | */ | 592 | */ |
584 | __event__synthesize_thread(comm_event, mmap_event, fork_event, pid, | 593 | __event__synthesize_thread(comm_event, mmap_event, fork_event, pid, |
585 | 1, process, tool, machine, mmap_data); | 594 | 1, process, tool, machine, mmap_data, |
595 | proc_map_timeout); | ||
586 | } | 596 | } |
587 | 597 | ||
588 | err = 0; | 598 | err = 0; |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 39868f529cab..c53f36384b64 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -384,10 +384,12 @@ typedef int (*perf_event__handler_t)(struct perf_tool *tool, | |||
384 | int perf_event__synthesize_thread_map(struct perf_tool *tool, | 384 | int perf_event__synthesize_thread_map(struct perf_tool *tool, |
385 | struct thread_map *threads, | 385 | struct thread_map *threads, |
386 | perf_event__handler_t process, | 386 | perf_event__handler_t process, |
387 | struct machine *machine, bool mmap_data); | 387 | struct machine *machine, bool mmap_data, |
388 | unsigned int proc_map_timeout); | ||
388 | int perf_event__synthesize_threads(struct perf_tool *tool, | 389 | int perf_event__synthesize_threads(struct perf_tool *tool, |
389 | perf_event__handler_t process, | 390 | perf_event__handler_t process, |
390 | struct machine *machine, bool mmap_data); | 391 | struct machine *machine, bool mmap_data, |
392 | unsigned int proc_map_timeout); | ||
391 | int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, | 393 | int perf_event__synthesize_kernel_mmap(struct perf_tool *tool, |
392 | perf_event__handler_t process, | 394 | perf_event__handler_t process, |
393 | struct machine *machine); | 395 | struct machine *machine); |
@@ -469,7 +471,8 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool, | |||
469 | pid_t pid, pid_t tgid, | 471 | pid_t pid, pid_t tgid, |
470 | perf_event__handler_t process, | 472 | perf_event__handler_t process, |
471 | struct machine *machine, | 473 | struct machine *machine, |
472 | bool mmap_data); | 474 | bool mmap_data, |
475 | unsigned int proc_map_timeout); | ||
473 | 476 | ||
474 | size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); | 477 | size_t perf_event__fprintf_comm(union perf_event *event, FILE *fp); |
475 | size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); | 478 | size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp); |
diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 8b3b1937cb9e..4744673aff1b 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c | |||
@@ -1913,12 +1913,13 @@ int machines__for_each_thread(struct machines *machines, | |||
1913 | 1913 | ||
1914 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, | 1914 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
1915 | struct target *target, struct thread_map *threads, | 1915 | struct target *target, struct thread_map *threads, |
1916 | perf_event__handler_t process, bool data_mmap) | 1916 | perf_event__handler_t process, bool data_mmap, |
1917 | unsigned int proc_map_timeout) | ||
1917 | { | 1918 | { |
1918 | if (target__has_task(target)) | 1919 | if (target__has_task(target)) |
1919 | return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap); | 1920 | return perf_event__synthesize_thread_map(tool, threads, process, machine, data_mmap, proc_map_timeout); |
1920 | else if (target__has_cpu(target)) | 1921 | else if (target__has_cpu(target)) |
1921 | return perf_event__synthesize_threads(tool, process, machine, data_mmap); | 1922 | return perf_event__synthesize_threads(tool, process, machine, data_mmap, proc_map_timeout); |
1922 | /* command specified */ | 1923 | /* command specified */ |
1923 | return 0; | 1924 | return 0; |
1924 | } | 1925 | } |
diff --git a/tools/perf/util/machine.h b/tools/perf/util/machine.h index cea62f6fb144..887798e511e9 100644 --- a/tools/perf/util/machine.h +++ b/tools/perf/util/machine.h | |||
@@ -222,13 +222,16 @@ int machines__for_each_thread(struct machines *machines, | |||
222 | 222 | ||
223 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, | 223 | int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool, |
224 | struct target *target, struct thread_map *threads, | 224 | struct target *target, struct thread_map *threads, |
225 | perf_event__handler_t process, bool data_mmap); | 225 | perf_event__handler_t process, bool data_mmap, |
226 | unsigned int proc_map_timeout); | ||
226 | static inline | 227 | static inline |
227 | int machine__synthesize_threads(struct machine *machine, struct target *target, | 228 | int machine__synthesize_threads(struct machine *machine, struct target *target, |
228 | struct thread_map *threads, bool data_mmap) | 229 | struct thread_map *threads, bool data_mmap, |
230 | unsigned int proc_map_timeout) | ||
229 | { | 231 | { |
230 | return __machine__synthesize_threads(machine, NULL, target, threads, | 232 | return __machine__synthesize_threads(machine, NULL, target, threads, |
231 | perf_event__process, data_mmap); | 233 | perf_event__process, data_mmap, |
234 | proc_map_timeout); | ||
232 | } | 235 | } |
233 | 236 | ||
234 | pid_t machine__get_current_tid(struct machine *machine, int cpu); | 237 | pid_t machine__get_current_tid(struct machine *machine, int cpu); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 2d882fd1f1b9..aa482c10469d 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1368,7 +1368,9 @@ static void perf_session__warn_about_errors(const struct perf_session *session) | |||
1368 | "not processed, if there are samples for addresses they\n" | 1368 | "not processed, if there are samples for addresses they\n" |
1369 | "will not be resolved, you may find out which are these\n" | 1369 | "will not be resolved, you may find out which are these\n" |
1370 | "threads by running with -v and redirecting the output\n" | 1370 | "threads by running with -v and redirecting the output\n" |
1371 | "to a file.\n", | 1371 | "to a file.\n" |
1372 | "The time limit to process proc map is too short?\n" | ||
1373 | "Increase it by --proc-map-timeout\n", | ||
1372 | stats->nr_proc_map_timeout); | 1374 | stats->nr_proc_map_timeout); |
1373 | } | 1375 | } |
1374 | } | 1376 | } |