Skip to content

Commit ef89325

Browse files
ahunter6acmel
authored andcommitted
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>
1 parent 0794029 commit ef89325

11 files changed

Lines changed: 35 additions & 47 deletions

File tree

‎tools/perf/builtin-inject.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
198198

199199
cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
200200

201-
thread = machine__findnew_thread(machine, event->ip.pid, event->ip.pid);
201+
thread = machine__findnew_thread(machine, sample->pid, sample->pid);
202202
if (thread == NULL) {
203203
pr_err("problem processing %d event, skipping it.\n",
204204
event->header.type);
205205
goto repipe;
206206
}
207207

208208
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
209-
event->ip.ip, &al);
209+
sample->ip, &al);
210210

211211
if (al.map != NULL) {
212212
if (!al.map->dso->hit) {

‎tools/perf/builtin-kmem.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
305305
struct perf_evsel *evsel,
306306
struct machine *machine)
307307
{
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);
310310

311311
if (thread == NULL) {
312312
pr_debug("problem processing %d event, skipping it.\n",

‎tools/perf/builtin-mem.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ dump_raw_samples(struct perf_tool *tool,
9494
symbol_conf.field_sep,
9595
sample->tid,
9696
symbol_conf.field_sep,
97-
event->ip.ip,
97+
sample->ip,
9898
symbol_conf.field_sep,
9999
sample->addr,
100100
symbol_conf.field_sep,

‎tools/perf/builtin-script.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,8 +501,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
501501
struct machine *machine)
502502
{
503503
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);
506506

507507
if (thread == NULL) {
508508
pr_debug("problem processing %d event, skipping it.\n",

‎tools/perf/builtin-top.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
689689
{
690690
struct perf_top *top = container_of(tool, struct perf_top, tool);
691691
struct symbol *parent = NULL;
692-
u64 ip = event->ip.ip;
692+
u64 ip = sample->ip;
693693
struct addr_location al;
694694
int err;
695695

@@ -699,10 +699,10 @@ static void perf_event__process_sample(struct perf_tool *tool,
699699
if (!seen)
700700
seen = intlist__new(NULL);
701701

702-
if (!intlist__has_entry(seen, event->ip.pid)) {
702+
if (!intlist__has_entry(seen, sample->pid)) {
703703
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);
706706
}
707707
return;
708708
}
@@ -836,7 +836,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
836836
break;
837837
case PERF_RECORD_MISC_GUEST_KERNEL:
838838
++top->guest_kernel_samples;
839-
machine = perf_session__find_machine(session, event->ip.pid);
839+
machine = perf_session__find_machine(session,
840+
sample.pid);
840841
break;
841842
case PERF_RECORD_MISC_GUEST_USER:
842843
++top->guest_us_samples;

‎tools/perf/tests/hists_link.c‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
211211
list_for_each_entry(evsel, &evlist->entries, node) {
212212
for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
213213
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,
220216
},
221217
};
222218

219+
sample.pid = fake_common_samples[k].pid;
220+
sample.ip = fake_common_samples[k].ip;
223221
if (perf_event__preprocess_sample(&event, machine, &al,
224222
&sample) < 0)
225223
goto out;
@@ -235,15 +233,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
235233

236234
for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) {
237235
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,
244238
},
245239
};
246240

241+
sample.pid = fake_samples[i][k].pid;
242+
sample.ip = fake_samples[i][k].ip;
247243
if (perf_event__preprocess_sample(&event, machine, &al,
248244
&sample) < 0)
249245
goto out;

‎tools/perf/util/build-id.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818

1919
int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
2020
union perf_event *event,
21-
struct perf_sample *sample __maybe_unused,
21+
struct perf_sample *sample,
2222
struct perf_evsel *evsel __maybe_unused,
2323
struct machine *machine)
2424
{
2525
struct addr_location al;
2626
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);
2929

3030
if (thread == NULL) {
3131
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,
3434
}
3535

3636
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
37-
event->ip.ip, &al);
37+
sample->ip, &al);
3838

3939
if (al.map != NULL)
4040
al.map->dso->hit = 1;

‎tools/perf/util/event.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,8 @@ int perf_event__preprocess_sample(const union perf_event *event,
686686
struct perf_sample *sample)
687687
{
688688
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);
691691

692692
if (thread == NULL)
693693
return -1;
@@ -709,7 +709,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
709709
machine__create_kernel_maps(machine);
710710

711711
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
712-
event->ip.ip, al);
712+
sample->ip, al);
713713
dump_printf(" ...... dso: %s\n",
714714
al->map ? al->map->dso->long_name :
715715
al->level == 'H' ? "[hypervisor]" : "<not found>");

‎tools/perf/util/event.h‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@
88
#include "map.h"
99
#include "build-id.h"
1010

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-
2111
struct mmap_event {
2212
struct perf_event_header header;
2313
u32 pid, tid;
@@ -166,7 +156,6 @@ struct tracing_data_event {
166156

167157
union perf_event {
168158
struct perf_event_header header;
169-
struct ip_event ip;
170159
struct mmap_event mmap;
171160
struct comm_event comm;
172161
struct fork_event fork;

‎tools/perf/util/evsel.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
11851185
return -EFAULT;
11861186

11871187
if (type & PERF_SAMPLE_IP) {
1188-
data->ip = event->ip.ip;
1188+
data->ip = *array;
11891189
array++;
11901190
}
11911191

@@ -1397,7 +1397,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
13971397
array = event->sample.array;
13981398

13991399
if (type & PERF_SAMPLE_IP) {
1400-
event->ip.ip = sample->ip;
1400+
*array = sample->ip;
14011401
array++;
14021402
}
14031403

0 commit comments

Comments
 (0)