Commit 84111b9c authored by Namhyung Kim's avatar Namhyung Kim Committed by Arnaldo Carvalho de Melo
Browse files

perf tools: Allow controlling synthesizing PERF_RECORD_ metadata events during record



Depending on the use case, it might require some kind of synthesizing
and some not.  Make it controllable to turn off heavy operations like
MMAP for all tasks.

Currently all users are converted to enable all the synthesis by
default.  It'll be updated in the later patch.

Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
Acked-by: default avatarJiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: https //lore.kernel.org/r/20210811044658.1313391-1-namhyung@kernel.org
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 8228e936
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ static int do_run_single_threaded(struct perf_session *session,
						NULL,
						target, threads,
						process_synthesized_event,
						data_mmap,
						true, data_mmap,
						nr_threads_synthesize);
		if (err)
			return err;
@@ -171,7 +171,7 @@ static int do_run_multi_threaded(struct target *target,
						NULL,
						target, NULL,
						process_synthesized_event,
						false,
						true, false,
						nr_threads_synthesize);
		if (err) {
			perf_session__delete(session);
+1 −1
Original line number Diff line number Diff line
@@ -1456,7 +1456,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->core.threads, false, 1);
				    kvm->evlist->core.threads, true, false, 1);
	err = kvm_live_open_events(kvm);
	if (err)
		goto out;
+4 −2
Original line number Diff line number Diff line
@@ -1266,6 +1266,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,
						 true,
						 rec->opts.sample_address);
	perf_thread_map__put(thread_map);
	return err;
@@ -1480,8 +1481,9 @@ static int record__synthesize(struct record *rec, bool tail)
		f = process_locked_synthesized_event;
	}

	err = __machine__synthesize_threads(machine, tool, &opts->target, rec->evlist->core.threads,
					    f, opts->sample_address,
	err = __machine__synthesize_threads(machine, tool, &opts->target,
					    rec->evlist->core.threads,
					    f, true, opts->sample_address,
					    rec->opts.nr_threads_synthesize);

	if (rec->opts.nr_threads_synthesize > 1)
+1 −1
Original line number Diff line number Diff line
@@ -1271,7 +1271,7 @@ static int __cmd_top(struct perf_top *top)
		pr_debug("Couldn't synthesize cgroup events.\n");

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

	if (top->nr_threads_synthesize > 1)
+2 −2
Original line number Diff line number Diff line
@@ -1628,8 +1628,8 @@ static int trace__symbols_init(struct trace *trace, struct evlist *evlist)
		goto out;

	err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
					    evlist->core.threads, trace__tool_process, false,
					    1);
					    evlist->core.threads, trace__tool_process,
					    true, false, 1);
out:
	if (err)
		symbol__exit();
Loading