Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fcb10e4 authored by Mark Drayton's avatar Mark Drayton Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Allow specifying proc-map-timeout in config file



The default timeout of 500ms for parsing /proc/<pid>/maps files is too
short for profiling many of our services.

This can be overridden by passing --proc-map-timeout to the relevant
command but it'd be nice to globally increase our default value.

This patch permits setting a different default with the
core.proc-map-timeout config file parameter.

Signed-off-by: default avatarMark Drayton <mbd@fb.com>
Acked-by: default avatarSong Liu <songliubraving@fb.com>
Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20181204203420.1683114-1-mbd@fb.com


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 65c9fee2
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -199,6 +199,12 @@ colors.*::
		Colors for headers in the output of a sub-commands (top, report).
		Default values are 'white', 'blue'.

core.*::
	core.proc-map-timeout::
		Sets a timeout (in milliseconds) for parsing /proc/<pid>/maps files.
		Can be overridden by the --proc-map-timeout option on supported
		subcommands. The default timeout is 500ms.

tui.*, gtk.*::
	Subcommands that can be configured here are 'top', 'report' and 'annotate'.
	These values are booleans, for example:
+2 −4
Original line number Diff line number Diff line
@@ -1364,7 +1364,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
			"show events other than"
			" HLT (x86 only) or Wait state (s390 only)"
			" that take longer than duration usecs"),
		OPT_UINTEGER(0, "proc-map-timeout", &kvm->opts.proc_map_timeout,
		OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
				"per thread proc mmap processing timeout in ms"),
		OPT_END()
	};
@@ -1394,7 +1394,6 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
	kvm->opts.target.uses_mmap = false;
	kvm->opts.target.uid_str = NULL;
	kvm->opts.target.uid = UINT_MAX;
	kvm->opts.proc_map_timeout = 500;

	symbol__init(NULL);
	disable_buildid_cache();
@@ -1453,8 +1452,7 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
	perf_session__set_id_hdr_size(kvm->session);
	ordered_events__set_copy_on_queue(&kvm->session->ordered_events, true);
	machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
				    kvm->evlist->threads, false,
				    kvm->opts.proc_map_timeout, 1);
				    kvm->evlist->threads, false, 1);
	err = kvm_live_open_events(kvm);
	if (err)
		goto out;
+3 −5
Original line number Diff line number Diff line
@@ -867,8 +867,7 @@ static int record__synthesize_workload(struct record *rec, bool tail)
	err = perf_event__synthesize_thread_map(&rec->tool, thread_map,
						 process_synthesized_event,
						 &rec->session->machines.host,
						 rec->opts.sample_address,
						 rec->opts.proc_map_timeout);
						 rec->opts.sample_address);
	thread_map__put(thread_map);
	return err;
}
@@ -1085,7 +1084,7 @@ static int record__synthesize(struct record *rec, bool tail)

	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->threads,
					    process_synthesized_event, opts->sample_address,
					    opts->proc_map_timeout, 1);
					    1);
out:
	return err;
}
@@ -1783,7 +1782,6 @@ static struct record record = {
			.uses_mmap   = true,
			.default_per_cpu = true,
		},
		.proc_map_timeout     = 500,
	},
	.tool = {
		.sample		= process_sample_event,
@@ -1913,7 +1911,7 @@ static struct option __record_options[] = {
	parse_clockid),
	OPT_STRING_OPTARG('S', "snapshot", &record.opts.auxtrace_snapshot_opts,
			  "opts", "AUX area tracing Snapshot Mode", ""),
	OPT_UINTEGER(0, "proc-map-timeout", &record.opts.proc_map_timeout,
	OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
			"per thread proc mmap processing timeout in ms"),
	OPT_BOOLEAN(0, "namespaces", &record.opts.record_namespaces,
		    "Record namespaces events"),
+1 −3
Original line number Diff line number Diff line
@@ -1096,7 +1096,6 @@ static int __cmd_top(struct perf_top *top)

	machine__synthesize_threads(&top->session->machines.host, &opts->target,
				    top->evlist->threads, false,
				    opts->proc_map_timeout,
				    top->nr_threads_synthesize);

	if (top->nr_threads_synthesize > 1)
@@ -1256,7 +1255,6 @@ int cmd_top(int argc, const char **argv)
			.target		= {
				.uses_mmap   = true,
			},
			.proc_map_timeout    = 500,
			/*
			 * FIXME: This will lose PERF_RECORD_MMAP and other metadata
			 * when we pause, fix that and reenable. Probably using a
@@ -1369,7 +1367,7 @@ int cmd_top(int argc, const char **argv)
	OPT_STRING('w', "column-widths", &symbol_conf.col_width_list_str,
		   "width[,width...]",
		   "don't try to adjust column width, use these fixed values"),
	OPT_UINTEGER(0, "proc-map-timeout", &opts->proc_map_timeout,
	OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
			"per thread proc mmap processing timeout in ms"),
	OPT_CALLBACK_NOOPT('b', "branch-any", &opts->branch_stack,
		     "branch any", "sample any taken branches",
+2 −3
Original line number Diff line number Diff line
@@ -1264,7 +1264,7 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)

	err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
					    evlist->threads, trace__tool_process, false,
					    trace->opts.proc_map_timeout, 1);
					    1);
out:
	if (err)
		symbol__exit();
@@ -3393,7 +3393,6 @@ int cmd_trace(int argc, const char **argv)
			.user_interval = ULLONG_MAX,
			.no_buffering  = true,
			.mmap_pages    = UINT_MAX,
			.proc_map_timeout  = 500,
		},
		.output = stderr,
		.show_comm = true,
@@ -3464,7 +3463,7 @@ int cmd_trace(int argc, const char **argv)
		     "Default: kernel.perf_event_max_stack or " __stringify(PERF_MAX_STACK_DEPTH)),
	OPT_BOOLEAN(0, "print-sample", &trace.print_sample,
			"print the PERF_RECORD_SAMPLE PERF_SAMPLE_ info, for debugging"),
	OPT_UINTEGER(0, "proc-map-timeout", &trace.opts.proc_map_timeout,
	OPT_UINTEGER(0, "proc-map-timeout", &proc_map_timeout,
			"per thread proc mmap processing timeout in ms"),
	OPT_CALLBACK('G', "cgroup", &trace, "name", "monitor event in cgroup name only",
		     trace__parse_cgroups),
Loading