perf is a tool which accesses the performance counter registers of an machine and gives out metrics to user to analyze the system performance.
What I am curious about is, when I read the parts of code. I see perf reading something from a memory mapped area (I feel it reads an area which is been written by the kernel), it is also reading /proc/modules, but I could not find any code related to actual read of hardware registers of machine.
- How does perf actually record its samples?
- How does it identify what function is an executable is executing?
- How does it know the symbols?
Does the kernel also have a module of perf inside (apart from /tools to convey the application 'perf' running in user space)?
Can anyone brief me about the internal working in detail?