Quick introduction to OCount

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%.

Advertisements
This entry was posted in Tools and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s