aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2013-08-27 04:23:06 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2013-08-29 14:29:28 -0400
commitef89325f773bc9f2f4e6019bd7f3d968ba85df9a (patch)
treea862b5eb16fa66c32558244796cb32264ca5af1f /tools
parent07940293ba7a43070cdebda952b0e6025d80a383 (diff)
perf tools: Remove references to struct ip_event
The ip_event struct assumes fixed positions for ip, pid and tid. That is no longer true with the addition of PERF_SAMPLE_IDENTIFIER. The information is anyway in struct sample, so use that instead. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Namhyung Kim <namhyung@gmail.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1377591794-30553-5-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-inject.c4
-rw-r--r--tools/perf/builtin-kmem.c4
-rw-r--r--tools/perf/builtin-mem.c2
-rw-r--r--tools/perf/builtin-script.c4
-rw-r--r--tools/perf/builtin-top.c11
-rw-r--r--tools/perf/tests/hists_link.c20
-rw-r--r--tools/perf/util/build-id.c8
-rw-r--r--tools/perf/util/event.c6
-rw-r--r--tools/perf/util/event.h11
-rw-r--r--tools/perf/util/evsel.c4
-rw-r--r--tools/perf/util/session.c8
11 files changed, 35 insertions, 47 deletions
diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
index 0d4ae1dd7b60..ffacd464f9f6 100644
--- a/tools/perf/builtin-inject.c
+++ b/tools/perf/builtin-inject.c
@@ -198,7 +198,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
198 198
199 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 199 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
200 200
201 thread = machine__findnew_thread(machine, event->ip.pid, event->ip.pid); 201 thread = machine__findnew_thread(machine, sample->pid, sample->pid);
202 if (thread == NULL) { 202 if (thread == NULL) {
203 pr_err("problem processing %d event, skipping it.\n", 203 pr_err("problem processing %d event, skipping it.\n",
204 event->header.type); 204 event->header.type);
@@ -206,7 +206,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
206 } 206 }
207 207
208 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, 208 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
209 event->ip.ip, &al); 209 sample->ip, &al);
210 210
211 if (al.map != NULL) { 211 if (al.map != NULL) {
212 if (!al.map->dso->hit) { 212 if (!al.map->dso->hit) {
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index c32477837cb0..c2dff9cb1f2c 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -305,8 +305,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
305 struct perf_evsel *evsel, 305 struct perf_evsel *evsel,
306 struct machine *machine) 306 struct machine *machine)
307{ 307{
308 struct thread *thread = machine__findnew_thread(machine, event->ip.pid, 308 struct thread *thread = machine__findnew_thread(machine, sample->pid,
309 event->ip.pid); 309 sample->pid);
310 310
311 if (thread == NULL) { 311 if (thread == NULL) {
312 pr_debug("problem processing %d event, skipping it.\n", 312 pr_debug("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/builtin-mem.c b/tools/perf/builtin-mem.c
index 706a1faa9559..791b432df847 100644
--- a/tools/perf/builtin-mem.c
+++ b/tools/perf/builtin-mem.c
@@ -94,7 +94,7 @@ dump_raw_samples(struct perf_tool *tool,
94 symbol_conf.field_sep, 94 symbol_conf.field_sep,
95 sample->tid, 95 sample->tid,
96 symbol_conf.field_sep, 96 symbol_conf.field_sep,
97 event->ip.ip, 97 sample->ip,
98 symbol_conf.field_sep, 98 symbol_conf.field_sep,
99 sample->addr, 99 sample->addr,
100 symbol_conf.field_sep, 100 symbol_conf.field_sep,
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index d82712f169b3..93a34cef9676 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -501,8 +501,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
501 struct machine *machine) 501 struct machine *machine)
502{ 502{
503 struct addr_location al; 503 struct addr_location al;
504 struct thread *thread = machine__findnew_thread(machine, event->ip.pid, 504 struct thread *thread = machine__findnew_thread(machine, sample->pid,
505 event->ip.tid); 505 sample->tid);
506 506
507 if (thread == NULL) { 507 if (thread == NULL) {
508 pr_debug("problem processing %d event, skipping it.\n", 508 pr_debug("problem processing %d event, skipping it.\n",
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index e37521fc715a..212214162bb2 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -689,7 +689,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
689{ 689{
690 struct perf_top *top = container_of(tool, struct perf_top, tool); 690 struct perf_top *top = container_of(tool, struct perf_top, tool);
691 struct symbol *parent = NULL; 691 struct symbol *parent = NULL;
692 u64 ip = event->ip.ip; 692 u64 ip = sample->ip;
693 struct addr_location al; 693 struct addr_location al;
694 int err; 694 int err;
695 695
@@ -699,10 +699,10 @@ static void perf_event__process_sample(struct perf_tool *tool,
699 if (!seen) 699 if (!seen)
700 seen = intlist__new(NULL); 700 seen = intlist__new(NULL);
701 701
702 if (!intlist__has_entry(seen, event->ip.pid)) { 702 if (!intlist__has_entry(seen, sample->pid)) {
703 pr_err("Can't find guest [%d]'s kernel information\n", 703 pr_err("Can't find guest [%d]'s kernel information\n",
704 event->ip.pid); 704 sample->pid);
705 intlist__add(seen, event->ip.pid); 705 intlist__add(seen, sample->pid);
706 } 706 }
707 return; 707 return;
708 } 708 }
@@ -836,7 +836,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
836 break; 836 break;
837 case PERF_RECORD_MISC_GUEST_KERNEL: 837 case PERF_RECORD_MISC_GUEST_KERNEL:
838 ++top->guest_kernel_samples; 838 ++top->guest_kernel_samples;
839 machine = perf_session__find_machine(session, event->ip.pid); 839 machine = perf_session__find_machine(session,
840 sample.pid);
840 break; 841 break;
841 case PERF_RECORD_MISC_GUEST_USER: 842 case PERF_RECORD_MISC_GUEST_USER:
842 ++top->guest_us_samples; 843 ++top->guest_us_samples;
diff --git a/tools/perf/tests/hists_link.c b/tools/perf/tests/hists_link.c
index 87f9f7280c40..4228ffc0d968 100644
--- a/tools/perf/tests/hists_link.c
+++ b/tools/perf/tests/hists_link.c
@@ -211,15 +211,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
211 list_for_each_entry(evsel, &evlist->entries, node) { 211 list_for_each_entry(evsel, &evlist->entries, node) {
212 for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { 212 for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
213 const union perf_event event = { 213 const union perf_event event = {
214 .ip = { 214 .header = {
215 .header = { 215 .misc = PERF_RECORD_MISC_USER,
216 .misc = PERF_RECORD_MISC_USER,
217 },
218 .pid = fake_common_samples[k].pid,
219 .ip = fake_common_samples[k].ip,
220 }, 216 },
221 }; 217 };
222 218
219 sample.pid = fake_common_samples[k].pid;
220 sample.ip = fake_common_samples[k].ip;
223 if (perf_event__preprocess_sample(&event, machine, &al, 221 if (perf_event__preprocess_sample(&event, machine, &al,
224 &sample) < 0) 222 &sample) < 0)
225 goto out; 223 goto out;
@@ -235,15 +233,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
235 233
236 for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { 234 for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) {
237 const union perf_event event = { 235 const union perf_event event = {
238 .ip = { 236 .header = {
239 .header = { 237 .misc = PERF_RECORD_MISC_USER,
240 .misc = PERF_RECORD_MISC_USER,
241 },
242 .pid = fake_samples[i][k].pid,
243 .ip = fake_samples[i][k].ip,
244 }, 238 },
245 }; 239 };
246 240
241 sample.pid = fake_samples[i][k].pid;
242 sample.ip = fake_samples[i][k].ip;
247 if (perf_event__preprocess_sample(&event, machine, &al, 243 if (perf_event__preprocess_sample(&event, machine, &al,
248 &sample) < 0) 244 &sample) < 0)
249 goto out; 245 goto out;
diff --git a/tools/perf/util/build-id.c b/tools/perf/util/build-id.c
index 0f9d27a6bc8f..fb584092eb88 100644
--- a/tools/perf/util/build-id.c
+++ b/tools/perf/util/build-id.c
@@ -18,14 +18,14 @@
18 18
19int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, 19int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
20 union perf_event *event, 20 union perf_event *event,
21 struct perf_sample *sample __maybe_unused, 21 struct perf_sample *sample,
22 struct perf_evsel *evsel __maybe_unused, 22 struct perf_evsel *evsel __maybe_unused,
23 struct machine *machine) 23 struct machine *machine)
24{ 24{
25 struct addr_location al; 25 struct addr_location al;
26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
27 struct thread *thread = machine__findnew_thread(machine, event->ip.pid, 27 struct thread *thread = machine__findnew_thread(machine, sample->pid,
28 event->ip.pid); 28 sample->pid);
29 29
30 if (thread == NULL) { 30 if (thread == NULL) {
31 pr_err("problem processing %d event, skipping it.\n", 31 pr_err("problem processing %d event, skipping it.\n",
@@ -34,7 +34,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
34 } 34 }
35 35
36 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, 36 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
37 event->ip.ip, &al); 37 sample->ip, &al);
38 38
39 if (al.map != NULL) 39 if (al.map != NULL)
40 al.map->dso->hit = 1; 40 al.map->dso->hit = 1;
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c
index 61cecf9caff1..8d51f21107aa 100644
--- a/tools/perf/util/event.c
+++ b/tools/perf/util/event.c
@@ -686,8 +686,8 @@ int perf_event__preprocess_sample(const union perf_event *event,
686 struct perf_sample *sample) 686 struct perf_sample *sample)
687{ 687{
688 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 688 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
689 struct thread *thread = machine__findnew_thread(machine, event->ip.pid, 689 struct thread *thread = machine__findnew_thread(machine, sample->pid,
690 event->ip.pid); 690 sample->pid);
691 691
692 if (thread == NULL) 692 if (thread == NULL)
693 return -1; 693 return -1;
@@ -709,7 +709,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
709 machine__create_kernel_maps(machine); 709 machine__create_kernel_maps(machine);
710 710
711 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, 711 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
712 event->ip.ip, al); 712 sample->ip, al);
713 dump_printf(" ...... dso: %s\n", 713 dump_printf(" ...... dso: %s\n",
714 al->map ? al->map->dso->long_name : 714 al->map ? al->map->dso->long_name :
715 al->level == 'H' ? "[hypervisor]" : "<not found>"); 715 al->level == 'H' ? "[hypervisor]" : "<not found>");
diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h
index 15db071d96b5..19d911c011cd 100644
--- a/tools/perf/util/event.h
+++ b/tools/perf/util/event.h
@@ -8,16 +8,6 @@
8#include "map.h" 8#include "map.h"
9#include "build-id.h" 9#include "build-id.h"
10 10
11/*
12 * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
13 */
14struct ip_event {
15 struct perf_event_header header;
16 u64 ip;
17 u32 pid, tid;
18 unsigned char __more_data[];
19};
20
21struct mmap_event { 11struct mmap_event {
22 struct perf_event_header header; 12 struct perf_event_header header;
23 u32 pid, tid; 13 u32 pid, tid;
@@ -166,7 +156,6 @@ struct tracing_data_event {
166 156
167union perf_event { 157union perf_event {
168 struct perf_event_header header; 158 struct perf_event_header header;
169 struct ip_event ip;
170 struct mmap_event mmap; 159 struct mmap_event mmap;
171 struct comm_event comm; 160 struct comm_event comm;
172 struct fork_event fork; 161 struct fork_event fork;
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 9a5fb23ff8e2..7e328c47f3b6 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -1185,7 +1185,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
1185 return -EFAULT; 1185 return -EFAULT;
1186 1186
1187 if (type & PERF_SAMPLE_IP) { 1187 if (type & PERF_SAMPLE_IP) {
1188 data->ip = event->ip.ip; 1188 data->ip = *array;
1189 array++; 1189 array++;
1190 } 1190 }
1191 1191
@@ -1397,7 +1397,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
1397 array = event->sample.array; 1397 array = event->sample.array;
1398 1398
1399 if (type & PERF_SAMPLE_IP) { 1399 if (type & PERF_SAMPLE_IP) {
1400 event->ip.ip = sample->ip; 1400 *array = sample->ip;
1401 array++; 1401 array++;
1402 } 1402 }
1403 1403
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index 07590c3c68b8..c3ac483be48e 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -840,7 +840,8 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
840 840
841static struct machine * 841static struct machine *
842 perf_session__find_machine_for_cpumode(struct perf_session *session, 842 perf_session__find_machine_for_cpumode(struct perf_session *session,
843 union perf_event *event) 843 union perf_event *event,
844 struct perf_sample *sample)
844{ 845{
845 const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 846 const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
846 847
@@ -852,7 +853,7 @@ static struct machine *
852 if (event->header.type == PERF_RECORD_MMAP) 853 if (event->header.type == PERF_RECORD_MMAP)
853 pid = event->mmap.pid; 854 pid = event->mmap.pid;
854 else 855 else
855 pid = event->ip.pid; 856 pid = sample->pid;
856 857
857 return perf_session__findnew_machine(session, pid); 858 return perf_session__findnew_machine(session, pid);
858 } 859 }
@@ -958,7 +959,8 @@ static int perf_session_deliver_event(struct perf_session *session,
958 hists__inc_nr_events(&evsel->hists, event->header.type); 959 hists__inc_nr_events(&evsel->hists, event->header.type);
959 } 960 }
960 961
961 machine = perf_session__find_machine_for_cpumode(session, event); 962 machine = perf_session__find_machine_for_cpumode(session, event,
963 sample);
962 964
963 switch (event->header.type) { 965 switch (event->header.type) {
964 case PERF_RECORD_SAMPLE: 966 case PERF_RECORD_SAMPLE: