Commit ef89325f773bc9f2f4e6019bd7f3d968ba85df9a

Authored by Adrian Hunter
Committed by Arnaldo Carvalho de Melo
1 parent 07940293ba

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>

Showing 11 changed files with 35 additions and 47 deletions Side-by-side Diff

tools/perf/builtin-inject.c
... ... @@ -198,7 +198,7 @@
198 198  
199 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 202 if (thread == NULL) {
203 203 pr_err("problem processing %d event, skipping it.\n",
204 204 event->header.type);
... ... @@ -206,7 +206,7 @@
206 206 }
207 207  
208 208 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
209   - event->ip.ip, &al);
  209 + sample->ip, &al);
210 210  
211 211 if (al.map != NULL) {
212 212 if (!al.map->dso->hit) {
tools/perf/builtin-kmem.c
... ... @@ -305,8 +305,8 @@
305 305 struct perf_evsel *evsel,
306 306 struct machine *machine)
307 307 {
308   - struct thread *thread = machine__findnew_thread(machine, event->ip.pid,
309   - event->ip.pid);
  308 + struct thread *thread = machine__findnew_thread(machine, sample->pid,
  309 + sample->pid);
310 310  
311 311 if (thread == NULL) {
312 312 pr_debug("problem processing %d event, skipping it.\n",
tools/perf/builtin-mem.c
... ... @@ -94,7 +94,7 @@
94 94 symbol_conf.field_sep,
95 95 sample->tid,
96 96 symbol_conf.field_sep,
97   - event->ip.ip,
  97 + sample->ip,
98 98 symbol_conf.field_sep,
99 99 sample->addr,
100 100 symbol_conf.field_sep,
tools/perf/builtin-script.c
... ... @@ -501,8 +501,8 @@
501 501 struct machine *machine)
502 502 {
503 503 struct addr_location al;
504   - struct thread *thread = machine__findnew_thread(machine, event->ip.pid,
505   - event->ip.tid);
  504 + struct thread *thread = machine__findnew_thread(machine, sample->pid,
  505 + sample->tid);
506 506  
507 507 if (thread == NULL) {
508 508 pr_debug("problem processing %d event, skipping it.\n",
tools/perf/builtin-top.c
... ... @@ -689,7 +689,7 @@
689 689 {
690 690 struct perf_top *top = container_of(tool, struct perf_top, tool);
691 691 struct symbol *parent = NULL;
692   - u64 ip = event->ip.ip;
  692 + u64 ip = sample->ip;
693 693 struct addr_location al;
694 694 int err;
695 695  
696 696  
... ... @@ -699,10 +699,10 @@
699 699 if (!seen)
700 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 703 pr_err("Can't find guest [%d]'s kernel information\n",
704   - event->ip.pid);
705   - intlist__add(seen, event->ip.pid);
  704 + sample->pid);
  705 + intlist__add(seen, sample->pid);
706 706 }
707 707 return;
708 708 }
... ... @@ -836,7 +836,8 @@
836 836 break;
837 837 case PERF_RECORD_MISC_GUEST_KERNEL:
838 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 841 break;
841 842 case PERF_RECORD_MISC_GUEST_USER:
842 843 ++top->guest_us_samples;
tools/perf/tests/hists_link.c
... ... @@ -211,15 +211,13 @@
211 211 list_for_each_entry(evsel, &evlist->entries, node) {
212 212 for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
213 213 const union perf_event event = {
214   - .ip = {
215   - .header = {
216   - .misc = PERF_RECORD_MISC_USER,
217   - },
218   - .pid = fake_common_samples[k].pid,
219   - .ip = fake_common_samples[k].ip,
  214 + .header = {
  215 + .misc = PERF_RECORD_MISC_USER,
220 216 },
221 217 };
222 218  
  219 + sample.pid = fake_common_samples[k].pid;
  220 + sample.ip = fake_common_samples[k].ip;
223 221 if (perf_event__preprocess_sample(&event, machine, &al,
224 222 &sample) < 0)
225 223 goto out;
226 224  
... ... @@ -235,15 +233,13 @@
235 233  
236 234 for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) {
237 235 const union perf_event event = {
238   - .ip = {
239   - .header = {
240   - .misc = PERF_RECORD_MISC_USER,
241   - },
242   - .pid = fake_samples[i][k].pid,
243   - .ip = fake_samples[i][k].ip,
  236 + .header = {
  237 + .misc = PERF_RECORD_MISC_USER,
244 238 },
245 239 };
246 240  
  241 + sample.pid = fake_samples[i][k].pid;
  242 + sample.ip = fake_samples[i][k].ip;
247 243 if (perf_event__preprocess_sample(&event, machine, &al,
248 244 &sample) < 0)
249 245 goto out;
tools/perf/util/build-id.c
... ... @@ -18,14 +18,14 @@
18 18  
19 19 int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
20 20 union perf_event *event,
21   - struct perf_sample *sample __maybe_unused,
  21 + struct perf_sample *sample,
22 22 struct perf_evsel *evsel __maybe_unused,
23 23 struct machine *machine)
24 24 {
25 25 struct addr_location al;
26 26 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
27   - struct thread *thread = machine__findnew_thread(machine, event->ip.pid,
28   - event->ip.pid);
  27 + struct thread *thread = machine__findnew_thread(machine, sample->pid,
  28 + sample->pid);
29 29  
30 30 if (thread == NULL) {
31 31 pr_err("problem processing %d event, skipping it.\n",
... ... @@ -34,7 +34,7 @@
34 34 }
35 35  
36 36 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
37   - event->ip.ip, &al);
  37 + sample->ip, &al);
38 38  
39 39 if (al.map != NULL)
40 40 al.map->dso->hit = 1;
tools/perf/util/event.c
... ... @@ -686,8 +686,8 @@
686 686 struct perf_sample *sample)
687 687 {
688 688 u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
689   - struct thread *thread = machine__findnew_thread(machine, event->ip.pid,
690   - event->ip.pid);
  689 + struct thread *thread = machine__findnew_thread(machine, sample->pid,
  690 + sample->pid);
691 691  
692 692 if (thread == NULL)
693 693 return -1;
... ... @@ -709,7 +709,7 @@
709 709 machine__create_kernel_maps(machine);
710 710  
711 711 thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
712   - event->ip.ip, al);
  712 + sample->ip, al);
713 713 dump_printf(" ...... dso: %s\n",
714 714 al->map ? al->map->dso->long_name :
715 715 al->level == 'H' ? "[hypervisor]" : "<not found>");
tools/perf/util/event.h
... ... @@ -8,16 +8,6 @@
8 8 #include "map.h"
9 9 #include "build-id.h"
10 10  
11   -/*
12   - * PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
13   - */
14   -struct ip_event {
15   - struct perf_event_header header;
16   - u64 ip;
17   - u32 pid, tid;
18   - unsigned char __more_data[];
19   -};
20   -
21 11 struct mmap_event {
22 12 struct perf_event_header header;
23 13 u32 pid, tid;
... ... @@ -166,7 +156,6 @@
166 156  
167 157 union perf_event {
168 158 struct perf_event_header header;
169   - struct ip_event ip;
170 159 struct mmap_event mmap;
171 160 struct comm_event comm;
172 161 struct fork_event fork;
tools/perf/util/evsel.c
... ... @@ -1185,7 +1185,7 @@
1185 1185 return -EFAULT;
1186 1186  
1187 1187 if (type & PERF_SAMPLE_IP) {
1188   - data->ip = event->ip.ip;
  1188 + data->ip = *array;
1189 1189 array++;
1190 1190 }
1191 1191  
... ... @@ -1397,7 +1397,7 @@
1397 1397 array = event->sample.array;
1398 1398  
1399 1399 if (type & PERF_SAMPLE_IP) {
1400   - event->ip.ip = sample->ip;
  1400 + *array = sample->ip;
1401 1401 array++;
1402 1402 }
1403 1403  
tools/perf/util/session.c
... ... @@ -840,7 +840,8 @@
840 840  
841 841 static struct machine *
842 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 846 const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
846 847  
... ... @@ -852,7 +853,7 @@
852 853 if (event->header.type == PERF_RECORD_MMAP)
853 854 pid = event->mmap.pid;
854 855 else
855   - pid = event->ip.pid;
  856 + pid = sample->pid;
856 857  
857 858 return perf_session__findnew_machine(session, pid);
858 859 }
... ... @@ -958,7 +959,8 @@
958 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 965 switch (event->header.type) {
964 966 case PERF_RECORD_SAMPLE: