perf tools: Add cpumode to struct perf_sample
To avoid parsing event->header.misc in many locations.
This will also allow setting perf.sample.{ip,cpumode} in a single place,
from tracepoint fields, as needed by 'perf kvm' with PPC guests, where
the guest hardware counters is not available at the host.
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-qp3yradhyt6q3wl895b1aat0@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
@@ -293,7 +293,6 @@ static int process_sample_event(struct machine *machine,
|
||||
{
|
||||
struct perf_sample sample;
|
||||
struct thread *thread;
|
||||
u8 cpumode;
|
||||
int ret;
|
||||
|
||||
if (perf_evlist__parse_sample(evlist, event, &sample)) {
|
||||
@@ -307,9 +306,7 @@ static int process_sample_event(struct machine *machine,
|
||||
return -1;
|
||||
}
|
||||
|
||||
cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
|
||||
|
||||
ret = read_object_code(sample.ip, READLEN, cpumode, thread, state);
|
||||
ret = read_object_code(sample.ip, READLEN, sample.cpumode, thread, state);
|
||||
thread__put(thread);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -100,9 +100,11 @@ struct machine *setup_fake_machine(struct machines *machines)
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(fake_mmap_info); i++) {
|
||||
struct perf_sample sample = {
|
||||
.cpumode = PERF_RECORD_MISC_USER,
|
||||
};
|
||||
union perf_event fake_mmap_event = {
|
||||
.mmap = {
|
||||
.header = { .misc = PERF_RECORD_MISC_USER, },
|
||||
.pid = fake_mmap_info[i].pid,
|
||||
.tid = fake_mmap_info[i].pid,
|
||||
.start = fake_mmap_info[i].start,
|
||||
@@ -114,7 +116,7 @@ struct machine *setup_fake_machine(struct machines *machines)
|
||||
strcpy(fake_mmap_event.mmap.filename,
|
||||
fake_mmap_info[i].filename);
|
||||
|
||||
machine__process_mmap_event(machine, &fake_mmap_event, NULL);
|
||||
machine__process_mmap_event(machine, &fake_mmap_event, &sample);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(fake_symbols); i++) {
|
||||
|
||||
@@ -97,6 +97,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
|
||||
else
|
||||
iter.ops = &hist_iter_normal;
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.pid = fake_samples[i].pid;
|
||||
sample.tid = fake_samples[i].pid;
|
||||
sample.ip = fake_samples[i].ip;
|
||||
|
||||
@@ -76,6 +76,7 @@ static int add_hist_entries(struct perf_evlist *evlist,
|
||||
hists->dso_filter = NULL;
|
||||
hists->symbol_filter_str = NULL;
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.pid = fake_samples[i].pid;
|
||||
sample.tid = fake_samples[i].pid;
|
||||
sample.ip = fake_samples[i].ip;
|
||||
|
||||
@@ -82,6 +82,7 @@ static int add_hist_entries(struct perf_evlist *evlist, struct machine *machine)
|
||||
},
|
||||
};
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.pid = fake_common_samples[k].pid;
|
||||
sample.tid = fake_common_samples[k].pid;
|
||||
sample.ip = fake_common_samples[k].ip;
|
||||
|
||||
@@ -63,6 +63,7 @@ static int add_hist_entries(struct hists *hists, struct machine *machine)
|
||||
.hide_unresolved = false,
|
||||
};
|
||||
|
||||
sample.cpumode = PERF_RECORD_MISC_USER;
|
||||
sample.cpu = fake_samples[i].cpu;
|
||||
sample.pid = fake_samples[i].pid;
|
||||
sample.tid = fake_samples[i].pid;
|
||||
|
||||
Reference in New Issue
Block a user