I want to collect the performance counter numbers while running some workload.
This can be done easily using existing LAPI performance counter infrastructure.
But, I want some more statistics like
- Number of instructions in ring level 0,1,2,3
- Number of load requests for l1 cache by different ring levels
- Length of a ring-level switch
So, effectively I want distinction between memory accesses of operating system and application.
Can someone please guide me as to how to do this ?
PS : I have not used performance counters before. So, things that may seem a bit trivial to you may actually help me. Thanks
PS : Is there any way to obtain execution trace and the memory access trace of a system without changing application behavior.
You can use hardware performance counter like perf.
Modern hardware provides hardware performance counter, so there are pretty good chances that your machine has this feature. Also you might need to put kernel drivers for it. (on ubuntu sudo apt-get is magic for this).
A little description of perf (imported from above link)
where those events are listed in above link.
Say out of many events, you want to get stats of
cyclesevent for belowperf stat -e cycles:u -e cycles:k -e cycles dd if=/dev/zero of=/dev/null count=100000where
uandkstands user and kernel respectively. you can also put all the events by separating them using comma.