Friday 29 December 2017

kernel - program context from perf sample event

I am using perf_event utility to collect PEBS sample in
kernel space. How can I get context information (interrupt/nmi context, program context)
from perf_sample_data? I can see that perf_regs contains register informations. Which
register bits indicate context of the sample?



Update:




I
am using perf_event_open from userspace and modifying kernel in the perf event handler.
I am configuring perf_event with following attribute (mem trans retired) for Intel
Broadwel machine.



struct
perf_event_attr pe = {
.type = PERF_TYPE_RAW,
.size =
sizeof(struct perf_event_attr),
.sample_period = 10003,

.sample_type = PEBS_SAMPLE_TYPE,
.exclude_user = 1,

.exclude_kernel = 0,
.exclude_hv = 0,

.disabled = 0,

.config = 0x1cd,
.config1 = 0x3,
.precise_ip =
3,
.exclude_callchain_kernel = 0,
.read_format = PERF_FORMAT_GROUP
| PERF_FORMAT_ID,
.task = 1,
};

perf_event_open(&pe, processId, -1, -1 /*group*/,
0);



In the
kernel space perf event handler, I have perf_sample_data on each sample event. How can I
know whether the sample was taken from interrupt handler or the sample was from process
context?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...