1

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

1 Answer 1

0
+50

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.

1
  • Yep. Looks like that's as good as it's going to get. Thanks for taking a peek.
    – Matthew G.
    Dec 17, 2013 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.