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

Commit a33fbd56 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf machine: Simplify synthesize_threads method

Several tools (top, kvm) don't need to be called back to process each of
the syntheiszed records, instead relying on the machine__process_event
function to change the per machine data structures that represent
threads and mmaps, so provide a way to ask for this common idiom.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-pusqibp8n3c4ynegd1frn4zd@git.kernel.org


Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 58d925dc
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -1544,9 +1544,8 @@ static int kvm_events_live(struct perf_kvm_stat *kvm,
	}
	kvm->session->evlist = kvm->evlist;
	perf_session__set_id_hdr_size(kvm->session);
	machine__synthesize_threads(&kvm->session->machines.host, &kvm->tool,
				    &kvm->opts.target, kvm->evlist->threads,
				    perf_event__process, false);
	machine__synthesize_threads(&kvm->session->machines.host, &kvm->opts.target,
				    kvm->evlist->threads, false);
	err = kvm_live_open_events(kvm);
	if (err)
		goto out;
+2 −2
Original line number Diff line number Diff line
@@ -480,7 +480,7 @@ static int __cmd_record(struct perf_record *rec, int argc, const char **argv)
					 perf_event__synthesize_guest_os, tool);
	}

	err = machine__synthesize_threads(machine, tool, &opts->target, evsel_list->threads,
	err = __machine__synthesize_threads(machine, tool, &opts->target, evsel_list->threads,
					    process_synthesized_event, opts->sample_address);
	if (err != 0)
		goto out_delete_session;
+2 −3
Original line number Diff line number Diff line
@@ -950,9 +950,8 @@ static int __cmd_top(struct perf_top *top)
	if (ret)
		goto out_delete;

	machine__synthesize_threads(&top->session->machines.host, &top->tool,
				    &opts->target, top->evlist->threads,
				    perf_event__process, false);
	machine__synthesize_threads(&top->session->machines.host, &opts->target,
				    top->evlist->threads, false);
	ret = perf_top__start_counters(top);
	if (ret)
		goto out_delete;
+2 −2
Original line number Diff line number Diff line
@@ -1340,7 +1340,7 @@ static int trace__symbols_init(struct trace *trace, struct perf_evlist *evlist)
	if (trace->host == NULL)
		return -ENOMEM;

	err = machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
	err = __machine__synthesize_threads(trace->host, &trace->tool, &trace->opts.target,
					    evlist->threads, trace__tool_process, false);
	if (err)
		symbol__exit();
+3 −3
Original line number Diff line number Diff line
@@ -1395,7 +1395,7 @@ int machine__for_each_thread(struct machine *machine,
	return rc;
}

int machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
int __machine__synthesize_threads(struct machine *machine, struct perf_tool *tool,
				  struct perf_target *target, struct thread_map *threads,
				  perf_event__handler_t process, bool data_mmap)
{
Loading