This is a post summarizing some of my effort learning to use ocount. ocount is similar to perf in the way it is used. However, it is better documented on what the events mean. The events usually have corresponding hardware counters, making the numbers more reliable.
First, learn to use the man page, man ocount has a lot of information in it.
ophelp gives the list of events that is available on the processor. One thing I found is that a lot of times you need to include the unit mask of the event to get it to work. You can have the same event with different masks to record different counters.
For example, if you don’t include 0x4f behind LLC_REFS: , you might see a zero. My experience has been that the default mask don’t always work.
ocount -e LLC_REFS:0x4f -p (pid)
To include multipel masks of the same event in one line
ocount -e LLC_REFS:0x4f,LLC_MISSES:0x41,dtlb_load_misses:0x81,dtlb_load_misses:0x82,dtlb_load_misses:0x84 -p 48060
The above command displays the following
Event Count % time counted
LLC_REFS 4,547,206,437 80.00
LLC_MISSES 627,589,601 80.00
dtlb_load_misses 2,835,930,606 80.00
dtlb_load_misses 2,834,490,426 80.00
dtlb_load_misses 133,055,640,313 80.00
One for each counter, but since multiple events share the same counter, they are counted only 80%.