Monday, 22 May 2017

perf - How can I read performance counters from the kernel?

I have been using the Linux perf tool in the user space. I want to write code that reads performance counters for a thread every time it does a context switch.



The steps required are:



1) Get a mechanism to read the performance counter registers.



2) Call step(1) from the scheduler after every context switch.



I am stuck at step(1) as I could not figure out which functions to call for reading the performance registers and how to describe an event while doing it.
I tried going through the docs and also this question How do I use performance counters inside of the kernel?.

No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...