Question

I'm using the ocount tool from the oprofile suite to count three different HW performance counters:

ocount --events=rtm_retired:commit,rtm_retired:start,rtm_retired:aborted programA

The problem is that because the three counters share a prefix, the output is irksomely ambiguous.

Event counts (actual) for programA:
    Event              Count                    % time counted
    rtm_retired        908                      100.00
    rtm_retired        908                      100.00
    rtm_retired        0                        100.00

The ordering is correct given the command line, but if I'm dumping all this stuff into files as I do experiments with other counters, it's possible to lose track of what counter is what.

Looking at the ocount manpage, I can't seem to figure out a way to force it give the full event name.

Added:

Looking at the sources, I'm not actually sure this is possible, as the three events above are just masks on the same counter, and the count-printing section of the sources seems to only deal with event names, not mask names.

Alas (but would love to be proven wrong).

Was it helpful?

Solution

If changing the source code for ocount isn't an option, you can always modify the output afterwards.

Try piping the output through this perl one liner:

ocount --events=rtm_retired:commit,rtm_retired:start,rtm_retired:aborted programA | \
perl -n -e ' @suffix = ("commit", "start", "aborted"); if ( m/rtm_retired/ ) { $count++; s/rtm_retired/rtm_retired:$suffix[$count-1]/;  } print $_;'

This should work as long as you make sure to keep track of the order of counters you pass to ocount and match the @suffix array to it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top