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:
@@ -1301,9 +1301,8 @@ out_problem:
|
||||
|
||||
int machine__process_mmap2_event(struct machine *machine,
|
||||
union perf_event *event,
|
||||
struct perf_sample *sample __maybe_unused)
|
||||
struct perf_sample *sample)
|
||||
{
|
||||
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
|
||||
struct thread *thread;
|
||||
struct map *map;
|
||||
enum map_type type;
|
||||
@@ -1312,8 +1311,8 @@ int machine__process_mmap2_event(struct machine *machine,
|
||||
if (dump_trace)
|
||||
perf_event__fprintf_mmap2(event, stdout);
|
||||
|
||||
if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
|
||||
cpumode == PERF_RECORD_MISC_KERNEL) {
|
||||
if (sample->cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
|
||||
sample->cpumode == PERF_RECORD_MISC_KERNEL) {
|
||||
ret = machine__process_kernel_mmap_event(machine, event);
|
||||
if (ret < 0)
|
||||
goto out_problem;
|
||||
@@ -1355,9 +1354,8 @@ out_problem:
|
||||
}
|
||||
|
||||
int machine__process_mmap_event(struct machine *machine, union perf_event *event,
|
||||
struct perf_sample *sample __maybe_unused)
|
||||
struct perf_sample *sample)
|
||||
{
|
||||
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
|
||||
struct thread *thread;
|
||||
struct map *map;
|
||||
enum map_type type;
|
||||
@@ -1366,8 +1364,8 @@ int machine__process_mmap_event(struct machine *machine, union perf_event *event
|
||||
if (dump_trace)
|
||||
perf_event__fprintf_mmap(event, stdout);
|
||||
|
||||
if (cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
|
||||
cpumode == PERF_RECORD_MISC_KERNEL) {
|
||||
if (sample->cpumode == PERF_RECORD_MISC_GUEST_KERNEL ||
|
||||
sample->cpumode == PERF_RECORD_MISC_KERNEL) {
|
||||
ret = machine__process_kernel_mmap_event(machine, event);
|
||||
if (ret < 0)
|
||||
goto out_problem;
|
||||
|
||||
Reference in New Issue
Block a user