Commit ef89325f authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

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: default avatarAdrian Hunter <adrian.hunter@intel.com>
Acked-by: default avatarNamhyung 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 07940293
...@@ -198,7 +198,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, ...@@ -198,7 +198,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
thread = machine__findnew_thread(machine, event->ip.pid, event->ip.pid); thread = machine__findnew_thread(machine, sample->pid, sample->pid);
if (thread == NULL) { if (thread == NULL) {
pr_err("problem processing %d event, skipping it.\n", pr_err("problem processing %d event, skipping it.\n",
event->header.type); event->header.type);
...@@ -206,7 +206,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool, ...@@ -206,7 +206,7 @@ static int perf_event__inject_buildid(struct perf_tool *tool,
} }
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
event->ip.ip, &al); sample->ip, &al);
if (al.map != NULL) { if (al.map != NULL) {
if (!al.map->dso->hit) { if (!al.map->dso->hit) {
......
...@@ -305,8 +305,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, ...@@ -305,8 +305,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
struct perf_evsel *evsel, struct perf_evsel *evsel,
struct machine *machine) struct machine *machine)
{ {
struct thread *thread = machine__findnew_thread(machine, event->ip.pid, struct thread *thread = machine__findnew_thread(machine, sample->pid,
event->ip.pid); sample->pid);
if (thread == NULL) { if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n", pr_debug("problem processing %d event, skipping it.\n",
......
...@@ -94,7 +94,7 @@ dump_raw_samples(struct perf_tool *tool, ...@@ -94,7 +94,7 @@ dump_raw_samples(struct perf_tool *tool,
symbol_conf.field_sep, symbol_conf.field_sep,
sample->tid, sample->tid,
symbol_conf.field_sep, symbol_conf.field_sep,
event->ip.ip, sample->ip,
symbol_conf.field_sep, symbol_conf.field_sep,
sample->addr, sample->addr,
symbol_conf.field_sep, symbol_conf.field_sep,
......
...@@ -501,8 +501,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused, ...@@ -501,8 +501,8 @@ static int process_sample_event(struct perf_tool *tool __maybe_unused,
struct machine *machine) struct machine *machine)
{ {
struct addr_location al; struct addr_location al;
struct thread *thread = machine__findnew_thread(machine, event->ip.pid, struct thread *thread = machine__findnew_thread(machine, sample->pid,
event->ip.tid); sample->tid);
if (thread == NULL) { if (thread == NULL) {
pr_debug("problem processing %d event, skipping it.\n", pr_debug("problem processing %d event, skipping it.\n",
......
...@@ -689,7 +689,7 @@ static void perf_event__process_sample(struct perf_tool *tool, ...@@ -689,7 +689,7 @@ static void perf_event__process_sample(struct perf_tool *tool,
{ {
struct perf_top *top = container_of(tool, struct perf_top, tool); struct perf_top *top = container_of(tool, struct perf_top, tool);
struct symbol *parent = NULL; struct symbol *parent = NULL;
u64 ip = event->ip.ip; u64 ip = sample->ip;
struct addr_location al; struct addr_location al;
int err; int err;
...@@ -699,10 +699,10 @@ static void perf_event__process_sample(struct perf_tool *tool, ...@@ -699,10 +699,10 @@ static void perf_event__process_sample(struct perf_tool *tool,
if (!seen) if (!seen)
seen = intlist__new(NULL); seen = intlist__new(NULL);
if (!intlist__has_entry(seen, event->ip.pid)) { if (!intlist__has_entry(seen, sample->pid)) {
pr_err("Can't find guest [%d]'s kernel information\n", pr_err("Can't find guest [%d]'s kernel information\n",
event->ip.pid); sample->pid);
intlist__add(seen, event->ip.pid); intlist__add(seen, sample->pid);
} }
return; return;
} }
...@@ -836,7 +836,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx) ...@@ -836,7 +836,8 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)
break; break;
case PERF_RECORD_MISC_GUEST_KERNEL: case PERF_RECORD_MISC_GUEST_KERNEL:
++top->guest_kernel_samples; ++top->guest_kernel_samples;
machine = perf_session__find_machine(session, event->ip.pid); machine = perf_session__find_machine(session,
sample.pid);
break; break;
case PERF_RECORD_MISC_GUEST_USER: case PERF_RECORD_MISC_GUEST_USER:
++top->guest_us_samples; ++top->guest_us_samples;
......
...@@ -211,15 +211,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) ...@@ -211,15 +211,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
list_for_each_entry(evsel, &evlist->entries, node) { list_for_each_entry(evsel, &evlist->entries, node) {
for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) { for (k = 0; k < ARRAY_SIZE(fake_common_samples); k++) {
const union perf_event event = { const union perf_event event = {
.ip = { .header = {
.header = { .misc = PERF_RECORD_MISC_USER,
.misc = PERF_RECORD_MISC_USER,
},
.pid = fake_common_samples[k].pid,
.ip = fake_common_samples[k].ip,
}, },
}; };
sample.pid = fake_common_samples[k].pid;
sample.ip = fake_common_samples[k].ip;
if (perf_event__preprocess_sample(&event, machine, &al, if (perf_event__preprocess_sample(&event, machine, &al,
&sample) < 0) &sample) < 0)
goto out; goto out;
...@@ -235,15 +233,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine) ...@@ -235,15 +233,13 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) { for (k = 0; k < ARRAY_SIZE(fake_samples[i]); k++) {
const union perf_event event = { const union perf_event event = {
.ip = { .header = {
.header = { .misc = PERF_RECORD_MISC_USER,
.misc = PERF_RECORD_MISC_USER,
},
.pid = fake_samples[i][k].pid,
.ip = fake_samples[i][k].ip,
}, },
}; };
sample.pid = fake_samples[i][k].pid;
sample.ip = fake_samples[i][k].ip;
if (perf_event__preprocess_sample(&event, machine, &al, if (perf_event__preprocess_sample(&event, machine, &al,
&sample) < 0) &sample) < 0)
goto out; goto out;
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused, int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
union perf_event *event, union perf_event *event,
struct perf_sample *sample __maybe_unused, struct perf_sample *sample,
struct perf_evsel *evsel __maybe_unused, struct perf_evsel *evsel __maybe_unused,
struct machine *machine) struct machine *machine)
{ {
struct addr_location al; struct addr_location al;
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct thread *thread = machine__findnew_thread(machine, event->ip.pid, struct thread *thread = machine__findnew_thread(machine, sample->pid,
event->ip.pid); sample->pid);
if (thread == NULL) { if (thread == NULL) {
pr_err("problem processing %d event, skipping it.\n", 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,7 +34,7 @@ int build_id__mark_dso_hit(struct perf_tool *tool __maybe_unused,
} }
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
event->ip.ip, &al); sample->ip, &al);
if (al.map != NULL) if (al.map != NULL)
al.map->dso->hit = 1; al.map->dso->hit = 1;
......
...@@ -686,8 +686,8 @@ int perf_event__preprocess_sample(const union perf_event *event, ...@@ -686,8 +686,8 @@ int perf_event__preprocess_sample(const union perf_event *event,
struct perf_sample *sample) struct perf_sample *sample)
{ {
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
struct thread *thread = machine__findnew_thread(machine, event->ip.pid, struct thread *thread = machine__findnew_thread(machine, sample->pid,
event->ip.pid); sample->pid);
if (thread == NULL) if (thread == NULL)
return -1; return -1;
...@@ -709,7 +709,7 @@ int perf_event__preprocess_sample(const union perf_event *event, ...@@ -709,7 +709,7 @@ int perf_event__preprocess_sample(const union perf_event *event,
machine__create_kernel_maps(machine); machine__create_kernel_maps(machine);
thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION, thread__find_addr_map(thread, machine, cpumode, MAP__FUNCTION,
event->ip.ip, al); sample->ip, al);
dump_printf(" ...... dso: %s\n", dump_printf(" ...... dso: %s\n",
al->map ? al->map->dso->long_name : al->map ? al->map->dso->long_name :
al->level == 'H' ? "[hypervisor]" : "<not found>"); al->level == 'H' ? "[hypervisor]" : "<not found>");
......
...@@ -8,16 +8,6 @@ ...@@ -8,16 +8,6 @@
#include "map.h" #include "map.h"
#include "build-id.h" #include "build-id.h"
/*
* PERF_SAMPLE_IP | PERF_SAMPLE_TID | *
*/
struct ip_event {
struct perf_event_header header;
u64 ip;
u32 pid, tid;
unsigned char __more_data[];
};
struct mmap_event { struct mmap_event {
struct perf_event_header header; struct perf_event_header header;
u32 pid, tid; u32 pid, tid;
...@@ -166,7 +156,6 @@ struct tracing_data_event { ...@@ -166,7 +156,6 @@ struct tracing_data_event {
union perf_event { union perf_event {
struct perf_event_header header; struct perf_event_header header;
struct ip_event ip;
struct mmap_event mmap; struct mmap_event mmap;
struct comm_event comm; struct comm_event comm;
struct fork_event fork; struct fork_event fork;
......
...@@ -1185,7 +1185,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event, ...@@ -1185,7 +1185,7 @@ int perf_evsel__parse_sample(struct perf_evsel *evsel, union perf_event *event,
return -EFAULT; return -EFAULT;
if (type & PERF_SAMPLE_IP) { if (type & PERF_SAMPLE_IP) {
data->ip = event->ip.ip; data->ip = *array;
array++; array++;
} }
...@@ -1397,7 +1397,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, ...@@ -1397,7 +1397,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
array = event->sample.array; array = event->sample.array;
if (type & PERF_SAMPLE_IP) { if (type & PERF_SAMPLE_IP) {
event->ip.ip = sample->ip; *array = sample->ip;
array++; array++;
} }
......
...@@ -840,7 +840,8 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event, ...@@ -840,7 +840,8 @@ static void dump_sample(struct perf_evsel *evsel, union perf_event *event,
static struct machine * static struct machine *
perf_session__find_machine_for_cpumode(struct perf_session *session, perf_session__find_machine_for_cpumode(struct perf_session *session,
union perf_event *event) union perf_event *event,
struct perf_sample *sample)
{ {
const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; const u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
...@@ -852,7 +853,7 @@ static struct machine * ...@@ -852,7 +853,7 @@ static struct machine *
if (event->header.type == PERF_RECORD_MMAP) if (event->header.type == PERF_RECORD_MMAP)
pid = event->mmap.pid; pid = event->mmap.pid;
else else
pid = event->ip.pid; pid = sample->pid;
return perf_session__findnew_machine(session, pid); return perf_session__findnew_machine(session, pid);
} }
...@@ -958,7 +959,8 @@ static int perf_session_deliver_event(struct perf_session *session, ...@@ -958,7 +959,8 @@ static int perf_session_deliver_event(struct perf_session *session,
hists__inc_nr_events(&evsel->hists, event->header.type); hists__inc_nr_events(&evsel->hists, event->header.type);
} }
machine = perf_session__find_machine_for_cpumode(session, event); machine = perf_session__find_machine_for_cpumode(session, event,
sample);
switch (event->header.type) { switch (event->header.type) {
case PERF_RECORD_SAMPLE: case PERF_RECORD_SAMPLE:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment