perf machine: Rename perf_event__preprocess_sample to machine__resolve
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: bb3eb56622d1b5932a7708d0af5f3b00f12817b6 Gitweb: http://git.kernel.org/tip/bb3eb56622d1b5932a7708d0af5f3b00f12817b6 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Tue, 22 Mar 2016 18:39:09 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Wed, 23 Mar 2016 12:03:08 -0300
perf machine: Rename perf_event__preprocess_sample to machine__resolve
Since we only deal with fields in the passed struct perf_sample move this method to struct machine, that is where the perf_sample fields will be resolved to a struct addr_location, i.e. thread, map, symbol, etc.
Cc Adrian Hunter <[email protected]>
Cc Hemant Kumar <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Naveen N. Rao <[email protected]>
Cc Ravi Bangoria <[email protected]>
Cc Wang Nan <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-annotate.c | 2 +- tools/perf/builtin-diff.c | 2 +- tools/perf/builtin-mem.c | 2 +- tools/perf/builtin-report.c | 2 +- tools/perf/builtin-script.c | 2 +- tools/perf/builtin-timechart.c | 2 +- tools/perf/builtin-top.c | 2 +- tools/perf/tests/hists_cumulate.c | 8 +------- tools/perf/tests/hists_filter.c | 8 +------- tools/perf/tests/hists_link.c | 19 +++---------------- tools/perf/tests/hists_output.c | 8 +------- tools/perf/util/event.c | 6 ++---- tools/perf/util/event.h | 6 ++---- 13 files changed, 17 insertions(+), 52 deletions(-)
tools/perf/builtin-annotate.c +1 -1
@@ -94,7 +94,7 @@ static int process_sample_event(struct perf_tool *tool,struct addr_location al;int ret =0 ; -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) { +if (machine__resolve (machine, &al, sample) <0 ) {pr_warning ("problem processing %d event, skipping it.\n" , event->header.type);return -1 ;
tools/perf/builtin-diff.c +1 -1
@@ -330,7 +330,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused,struct hists *hists =evsel__hists (evsel);int ret =-1 ; -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) { +if (machine__resolve (machine, &al, sample) <0 ) {pr_warning ("problem processing %d event, skipping it.\n" , event->header.type);return -1 ;
tools/perf/builtin-mem.c +1 -1
@@ -131,7 +131,7 @@ dump_raw_samples(struct perf_tool *tool,struct addr_location al;const char *fmt; -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) { +if (machine__resolve (machine, &al, sample) <0 ) {fprintf (stderr,"problem processing %d event, skipping it.\n" , event->header.type);return -1 ;
tools/perf/builtin-report.c +1 -1
@@ -154,7 +154,7 @@ static int process_sample_event(struct perf_tool *tool, };int ret =0 ; -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) { +if (machine__resolve (machine, &al, sample) <0 ) {pr_debug ("problem processing %d event, skipping it.\n" , event->header.type);return -1 ;
tools/perf/builtin-script.c +1 -1
@@ -904,7 +904,7 @@ static int process_sample_event(struct perf_tool *tool,return 0 ; } -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) { +if (machine__resolve (machine, &al, sample) <0 ) {pr_err ("problem processing %d event, skipping it.\n" , event->header.type);return -1 ;
tools/perf/builtin-timechart.c +1 -1
@@ -489,7 +489,7 @@ static const char *cat_backtrace(union perf_event *event,if (!chain) goto exit; -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) { +if (machine__resolve (machine, &al, sample) <0 ) {fprintf (stderr,"problem processing %d event, skipping it.\n" , event->header.type); goto exit;
tools/perf/builtin-top.c +1 -1
@@ -728,7 +728,7 @@ static void perf_event__process_sample(struct perf_tool *tool,if (event->header.misc &PERF_RECORD_MISC_EXACT_IP ) top->exact_samples++; -if (perf_event__preprocess_sample (event, machine, &al, sample) <0 ) +if (machine__resolve (machine, &al, sample) <0 )return ; if (!top->kptr_restrict_warned &&
tools/perf/tests/hists_cumulate.c +1 -7
@@ -81,11 +81,6 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)size_t i;for (i =0 ; i <ARRAY_SIZE (fake_samples); i++) { -const union perf_event event = { - .header = { - .misc =PERF_RECORD_MISC_USER , - }, - };struct hist_entry_iter iter = { .evsel = evsel, .sample = &sample,
@@ -103,8 +98,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) sample.ip = fake_samples[i].ip; sample.callchain = (struct ip_callchain *)fake_callchains[i]; -if (perf_event__preprocess_sample (&event, machine, &al, - &sample) <0 ) +if (machine__resolve (machine, &al, &sample) <0 ) goto out; if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
tools/perf/tests/hists_filter.c +1 -7
@@ -58,11 +58,6 @@ static int add_hist_entries(struct perf_evlist *evlist,*/ evlist__for_each (evlist, evsel) {for (i =0 ; i <ARRAY_SIZE (fake_samples); i++) { -const union perf_event event = { - .header = { - .misc =PERF_RECORD_MISC_USER , - }, - };struct hist_entry_iter iter = { .evsel = evsel, .sample = &sample,
@@ -81,8 +76,7 @@ static int add_hist_entries(struct perf_evlist *evlist, sample.tid = fake_samples[i].pid; sample.ip = fake_samples[i].ip; -if (perf_event__preprocess_sample (&event, machine, &al, - &sample) <0 ) +if (machine__resolve (machine, &al, &sample) <0 ) goto out; al.socket = fake_samples[i].socket;
tools/perf/tests/hists_link.c +3 -16
@@ -76,18 +76,12 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)struct hists *hists =evsel__hists (evsel);for (k =0 ; k <ARRAY_SIZE (fake_common_samples); k++) { -const union perf_event event = { - .header = { - .misc =PERF_RECORD_MISC_USER , - }, - }; - sample.cpumode =PERF_RECORD_MISC_USER ; sample.pid = fake_common_samples[k].pid; sample.tid = fake_common_samples[k].pid; sample.ip = fake_common_samples[k].ip; -if (perf_event__preprocess_sample (&event, machine, &al, - &sample) <0 ) + +if (machine__resolve (machine, &al, &sample) <0 ) goto out; he = __hists__add_entry(hists, &al, NULL,
@@ -103,17 +97,10 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) }for (k =0 ; k <ARRAY_SIZE (fake_samples[i]); k++) { -const union perf_event event = { - .header = { - .misc =PERF_RECORD_MISC_USER , - }, - }; - sample.pid = fake_samples[i][k].pid; sample.tid = fake_samples[i][k].pid; sample.ip = fake_samples[i][k].ip; -if (perf_event__preprocess_sample (&event, machine, &al, - &sample) <0 ) +if (machine__resolve (machine, &al, &sample) <0 ) goto out; he = __hists__add_entry(hists, &al, NULL,
tools/perf/tests/hists_output.c +1 -7
@@ -51,11 +51,6 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)size_t i;for (i =0 ; i <ARRAY_SIZE (fake_samples); i++) { -const union perf_event event = { - .header = { - .misc =PERF_RECORD_MISC_USER , - }, - };struct hist_entry_iter iter = { .evsel = evsel, .sample = &sample,
@@ -69,8 +64,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) sample.tid = fake_samples[i].pid; sample.ip = fake_samples[i].ip; -if (perf_event__preprocess_sample (&event, machine, &al, - &sample) <0 ) +if (machine__resolve (machine, &al, &sample) <0 ) goto out; if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH,
tools/perf/util/event.c +2 -4
@@ -1295,10 +1295,8 @@ void thread__find_addr_location(struct thread *thread,* Callers need to drop the reference to al->thread, obtained in * machine__findnew_thread() */ -int perf_event__preprocess_sample (const union perf_event *event__maybe_unused , -struct machine *machine, -struct addr_location *al, -struct perf_sample *sample) +int machine__resolve (struct machine *machine,struct addr_location *al, +struct perf_sample *sample) {struct thread *thread =machine__findnew_thread (machine, sample->pid, sample->tid);
tools/perf/util/event.h +2 -4
@@ -598,10 +598,8 @@ int perf_event__process(struct perf_tool *tool,struct addr_location ; -int perf_event__preprocess_sample (const union perf_event *event, -struct machine *machine, -struct addr_location *al, -struct perf_sample *sample); +int machine__resolve (struct machine *machine,struct addr_location *al, +struct perf_sample *sample);void addr_location__put (struct addr_location *al);