diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-22 17:39:09 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-03-23 11:03:08 -0400 |
commit | bb3eb56622d1b5932a7708d0af5f3b00f12817b6 (patch) | |
tree | 1cd94932c5512ea0653b53449c0245749d78f452 | |
parent | 473398a21d28c089555117a8db4ea04e371dd03c (diff) |
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 <adrian.hunter@intel.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-a1ww2lbm2vbuqsv4p7ilubu9@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/builtin-annotate.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-diff.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-mem.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-script.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-timechart.c | 2 | ||||
-rw-r--r-- | tools/perf/builtin-top.c | 2 | ||||
-rw-r--r-- | tools/perf/tests/hists_cumulate.c | 8 | ||||
-rw-r--r-- | tools/perf/tests/hists_filter.c | 8 | ||||
-rw-r--r-- | tools/perf/tests/hists_link.c | 19 | ||||
-rw-r--r-- | tools/perf/tests/hists_output.c | 8 | ||||
-rw-r--r-- | tools/perf/util/event.c | 6 | ||||
-rw-r--r-- | tools/perf/util/event.h | 6 |
13 files changed, 17 insertions, 52 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index cfe366375c4b..814158393656 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -94,7 +94,7 @@ static int process_sample_event(struct perf_tool *tool, | |||
94 | struct addr_location al; | 94 | struct addr_location al; |
95 | int ret = 0; | 95 | int ret = 0; |
96 | 96 | ||
97 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 97 | if (machine__resolve(machine, &al, sample) < 0) { |
98 | pr_warning("problem processing %d event, skipping it.\n", | 98 | pr_warning("problem processing %d event, skipping it.\n", |
99 | event->header.type); | 99 | event->header.type); |
100 | return -1; | 100 | return -1; |
diff --git a/tools/perf/builtin-diff.c b/tools/perf/builtin-diff.c index 4d72359fd15a..8053a8ceefda 100644 --- a/tools/perf/builtin-diff.c +++ b/tools/perf/builtin-diff.c | |||
@@ -330,7 +330,7 @@ static int diff__process_sample_event(struct perf_tool *tool __maybe_unused, | |||
330 | struct hists *hists = evsel__hists(evsel); | 330 | struct hists *hists = evsel__hists(evsel); |
331 | int ret = -1; | 331 | int ret = -1; |
332 | 332 | ||
333 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 333 | if (machine__resolve(machine, &al, sample) < 0) { |
334 | pr_warning("problem processing %d event, skipping it.\n", | 334 | pr_warning("problem processing %d event, skipping it.\n", |
335 | event->header.type); | 335 | event->header.type); |
336 | return -1; | 336 | return -1; |
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c index 88aeac9aa1da..85db3be4b3cb 100644 --- a/tools/perf/builtin-mem.c +++ b/tools/perf/builtin-mem.c | |||
@@ -131,7 +131,7 @@ dump_raw_samples(struct perf_tool *tool, | |||
131 | struct addr_location al; | 131 | struct addr_location al; |
132 | const char *fmt; | 132 | const char *fmt; |
133 | 133 | ||
134 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 134 | if (machine__resolve(machine, &al, sample) < 0) { |
135 | fprintf(stderr, "problem processing %d event, skipping it.\n", | 135 | fprintf(stderr, "problem processing %d event, skipping it.\n", |
136 | event->header.type); | 136 | event->header.type); |
137 | return -1; | 137 | return -1; |
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 7eea49f9ed46..ab47273a5373 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -154,7 +154,7 @@ static int process_sample_event(struct perf_tool *tool, | |||
154 | }; | 154 | }; |
155 | int ret = 0; | 155 | int ret = 0; |
156 | 156 | ||
157 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 157 | if (machine__resolve(machine, &al, sample) < 0) { |
158 | pr_debug("problem processing %d event, skipping it.\n", | 158 | pr_debug("problem processing %d event, skipping it.\n", |
159 | event->header.type); | 159 | event->header.type); |
160 | return -1; | 160 | return -1; |
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 928a4411e023..02a65d15c594 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -904,7 +904,7 @@ static int process_sample_event(struct perf_tool *tool, | |||
904 | return 0; | 904 | return 0; |
905 | } | 905 | } |
906 | 906 | ||
907 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 907 | if (machine__resolve(machine, &al, sample) < 0) { |
908 | pr_err("problem processing %d event, skipping it.\n", | 908 | pr_err("problem processing %d event, skipping it.\n", |
909 | event->header.type); | 909 | event->header.type); |
910 | return -1; | 910 | return -1; |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index bd7a7757176f..40cc9bb3506c 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -489,7 +489,7 @@ static const char *cat_backtrace(union perf_event *event, | |||
489 | if (!chain) | 489 | if (!chain) |
490 | goto exit; | 490 | goto exit; |
491 | 491 | ||
492 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { | 492 | if (machine__resolve(machine, &al, sample) < 0) { |
493 | fprintf(stderr, "problem processing %d event, skipping it.\n", | 493 | fprintf(stderr, "problem processing %d event, skipping it.\n", |
494 | event->header.type); | 494 | event->header.type); |
495 | goto exit; | 495 | goto exit; |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index a287800bc495..9b0f2df2faa0 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -728,7 +728,7 @@ static void perf_event__process_sample(struct perf_tool *tool, | |||
728 | if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) | 728 | if (event->header.misc & PERF_RECORD_MISC_EXACT_IP) |
729 | top->exact_samples++; | 729 | top->exact_samples++; |
730 | 730 | ||
731 | if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) | 731 | if (machine__resolve(machine, &al, sample) < 0) |
732 | return; | 732 | return; |
733 | 733 | ||
734 | if (!top->kptr_restrict_warned && | 734 | if (!top->kptr_restrict_warned && |
diff --git a/tools/perf/tests/hists_cumulate.c b/tools/perf/tests/hists_cumulate.c index cf7eef73fbe6..ed5aa9eaeb6c 100644 --- a/tools/perf/tests/hists_cumulate.c +++ b/tools/perf/tests/hists_cumulate.c | |||
@@ -81,11 +81,6 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
81 | size_t i; | 81 | size_t i; |
82 | 82 | ||
83 | for (i = 0; i < ARRAY_SIZE(fake_samples); i++) { | 83 | for (i = 0; i < ARRAY_SIZE(fake_samples); i++) { |
84 | const union perf_event event = { | ||
85 | .header = { | ||
86 | .misc = PERF_RECORD_MISC_USER, | ||
87 | }, | ||
88 | }; | ||
89 | struct hist_entry_iter iter = { | 84 | struct hist_entry_iter iter = { |
90 | .evsel = evsel, | 85 | .evsel = evsel, |
91 | .sample = &sample, | 86 | .sample = &sample, |
@@ -103,8 +98,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
103 | sample.ip = fake_samples[i].ip; | 98 | sample.ip = fake_samples[i].ip; |
104 | sample.callchain = (struct ip_callchain *)fake_callchains[i]; | 99 | sample.callchain = (struct ip_callchain *)fake_callchains[i]; |
105 | 100 | ||
106 | if (perf_event__preprocess_sample(&event, machine, &al, | 101 | if (machine__resolve(machine, &al, &sample) < 0) |
107 | &sample) < 0) | ||
108 | goto out; | 102 | goto out; |
109 | 103 | ||
110 | if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH, | 104 | if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH, |
diff --git a/tools/perf/tests/hists_filter.c b/tools/perf/tests/hists_filter.c index 1c9e19352cb6..b825d24f8186 100644 --- a/tools/perf/tests/hists_filter.c +++ b/tools/perf/tests/hists_filter.c | |||
@@ -58,11 +58,6 @@ static int add_hist_entries(struct perf_evlist *evlist, | |||
58 | */ | 58 | */ |
59 | evlist__for_each(evlist, evsel) { | 59 | evlist__for_each(evlist, evsel) { |
60 | for (i = 0; i < ARRAY_SIZE(fake_samples); i++) { | 60 | for (i = 0; i < ARRAY_SIZE(fake_samples); i++) { |
61 | const union perf_event event = { | ||
62 | .header = { | ||
63 | .misc = PERF_RECORD_MISC_USER, | ||
64 | }, | ||
65 | }; | ||
66 | struct hist_entry_iter iter = { | 61 | struct hist_entry_iter iter = { |
67 | .evsel = evsel, | 62 | .evsel = evsel, |
68 | .sample = &sample, | 63 | .sample = &sample, |
@@ -81,8 +76,7 @@ static int add_hist_entries(struct perf_evlist *evlist, | |||
81 | sample.tid = fake_samples[i].pid; | 76 | sample.tid = fake_samples[i].pid; |
82 | sample.ip = fake_samples[i].ip; | 77 | sample.ip = fake_samples[i].ip; |
83 | 78 | ||
84 | if (perf_event__preprocess_sample(&event, machine, &al, | 79 | if (machine__resolve(machine, &al, &sample) < 0) |
85 | &sample) < 0) | ||
86 | goto out; | 80 | goto out; |
87 | 81 | ||
88 | al.socket = fake_samples[i].socket; | 82 | al.socket = fake_samples[i].socket; |
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c index 7885b1d324e4..358324e47805 100644 --- a/tools/perf/tests/hists_link.c +++ b/tools/perf/tests/hists_link.c | |||
@@ -76,18 +76,12 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
76 | struct hists *hists = evsel__hists(evsel); | 76 | struct hists *hists = evsel__hists(evsel); |
77 | 77 | ||
78 | for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { | 78 | for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { |
79 | const union perf_event event = { | ||
80 | .header = { | ||
81 | .misc = PERF_RECORD_MISC_USER, | ||
82 | }, | ||
83 | }; | ||
84 | |||
85 | sample.cpumode = PERF_RECORD_MISC_USER; | 79 | sample.cpumode = PERF_RECORD_MISC_USER; |
86 | sample.pid = fake_common_samples[k].pid; | 80 | sample.pid = fake_common_samples[k].pid; |
87 | sample.tid = fake_common_samples[k].pid; | 81 | sample.tid = fake_common_samples[k].pid; |
88 | sample.ip = fake_common_samples[k].ip; | 82 | sample.ip = fake_common_samples[k].ip; |
89 | if (perf_event__preprocess_sample(&event, machine, &al, | 83 | |
90 | &sample) < 0) | 84 | if (machine__resolve(machine, &al, &sample) < 0) |
91 | goto out; | 85 | goto out; |
92 | 86 | ||
93 | he = __hists__add_entry(hists, &al, NULL, | 87 | he = __hists__add_entry(hists, &al, NULL, |
@@ -103,17 +97,10 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) | |||
103 | } | 97 | } |
104 | 98 | ||
105 | for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { | 99 | for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { |
106 | const union perf_event event = { | ||
107 | .header = { | ||
108 | .misc = PERF_RECORD_MISC_USER, | ||
109 | }, | ||
110 | }; | ||
111 | |||
112 | sample.pid = fake_samples[i][k].pid; | 100 | sample.pid = fake_samples[i][k].pid; |
113 | sample.tid = fake_samples[i][k].pid; | 101 | sample.tid = fake_samples[i][k].pid; |
114 | sample.ip = fake_samples[i][k].ip; | 102 | sample.ip = fake_samples[i][k].ip; |
115 | if (perf_event__preprocess_sample(&event, machine, &al, | 103 | if (machine__resolve(machine, &al, &sample) < 0) |
116 | &sample) < 0) | ||
117 | goto out; | 104 | goto out; |
118 | 105 | ||
119 | he = __hists__add_entry(hists, &al, NULL, | 106 | he = __hists__add_entry(hists, &al, NULL, |
diff --git a/tools/perf/tests/hists_output.c b/tools/perf/tests/hists_output.c index 03e4e9c47a55..d3556fbe8c5c 100644 --- a/tools/perf/tests/hists_output.c +++ b/tools/perf/tests/hists_output.c | |||
@@ -51,11 +51,6 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
51 | size_t i; | 51 | size_t i; |
52 | 52 | ||
53 | for (i = 0; i < ARRAY_SIZE(fake_samples); i++) { | 53 | for (i = 0; i < ARRAY_SIZE(fake_samples); i++) { |
54 | const union perf_event event = { | ||
55 | .header = { | ||
56 | .misc = PERF_RECORD_MISC_USER, | ||
57 | }, | ||
58 | }; | ||
59 | struct hist_entry_iter iter = { | 54 | struct hist_entry_iter iter = { |
60 | .evsel = evsel, | 55 | .evsel = evsel, |
61 | .sample = &sample, | 56 | .sample = &sample, |
@@ -69,8 +64,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine) | |||
69 | sample.tid = fake_samples[i].pid; | 64 | sample.tid = fake_samples[i].pid; |
70 | sample.ip = fake_samples[i].ip; | 65 | sample.ip = fake_samples[i].ip; |
71 | 66 | ||
72 | if (perf_event__preprocess_sample(&event, machine, &al, | 67 | if (machine__resolve(machine, &al, &sample) < 0) |
73 | &sample) < 0) | ||
74 | goto out; | 68 | goto out; |
75 | 69 | ||
76 | if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH, | 70 | if (hist_entry_iter__add(&iter, &al, PERF_MAX_STACK_DEPTH, |
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index f679caac12d0..a89c29e2e0a9 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -1295,10 +1295,8 @@ void thread__find_addr_location(struct thread *thread, | |||
1295 | * Callers need to drop the reference to al->thread, obtained in | 1295 | * Callers need to drop the reference to al->thread, obtained in |
1296 | * machine__findnew_thread() | 1296 | * machine__findnew_thread() |
1297 | */ | 1297 | */ |
1298 | int perf_event__preprocess_sample(const union perf_event *event __maybe_unused, | 1298 | int machine__resolve(struct machine *machine, struct addr_location *al, |
1299 | struct machine *machine, | 1299 | struct perf_sample *sample) |
1300 | struct addr_location *al, | ||
1301 | struct perf_sample *sample) | ||
1302 | { | 1300 | { |
1303 | struct thread *thread = machine__findnew_thread(machine, sample->pid, | 1301 | struct thread *thread = machine__findnew_thread(machine, sample->pid, |
1304 | sample->tid); | 1302 | sample->tid); |
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index f5a2e67c86aa..22921fd0f5b8 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h | |||
@@ -598,10 +598,8 @@ int perf_event__process(struct perf_tool *tool, | |||
598 | 598 | ||
599 | struct addr_location; | 599 | struct addr_location; |
600 | 600 | ||
601 | int perf_event__preprocess_sample(const union perf_event *event, | 601 | int machine__resolve(struct machine *machine, struct addr_location *al, |
602 | struct machine *machine, | 602 | struct perf_sample *sample); |
603 | struct addr_location *al, | ||
604 | struct perf_sample *sample); | ||
605 | 603 | ||
606 | void addr_location__put(struct addr_location *al); | 604 | void addr_location__put(struct addr_location *al); |
607 | 605 | ||