Creating custom performance counters with kernel space gator
In addition to the hardware-specific and Linux performance counters that you can configure using the Counter Configuration dialog, the gator daemon and driver provide hooks that enable you to create custom counters.
NoteThis topic only applies if you are using kernel space gator. If you are using user space gator, create custom counters using the macros
Streamline derives its default set of counters from the performance monitoring unit, Linux hooks, and memory-mapped peripherals. You can add your own counters to this list if there is a hardware metric that you want to track which Streamline does not provide by default.
To create your own counters, mimic the methods used in the gator_events_mmapped.c file or any of the other
x files included with the gator driver source.
The gator driver source code is available from either of the following locations:
Follow these steps to ensure that
gatord interacts with your custom source:
Create an empty gator_events_
your_custom.c file or duplicate gator_events_mmapped.c.
Update the makefile to build the new gator_events_
- Add the preprocessor directive #include "gator.h" if you do not use gator_events_mmapped.c as a template.
Implement the following functions in your new source file:
All of your new counters must be added to the events list. To
Create a new XML file in the same directory as the makefile before
gatord. The makefile pulls in any file that begins with events-, so create an XML file called events-
Define how many counters exist in your custom set using the
<counter_set name="counter_name" count="x">tag. Give your counter a unique, descriptive name and enter how many counters are available for the count attribute. For example: <counter_set name="ARM_Cortex-A9_cnt" count="6"/>
For each counter set, you must list each of the possible events. Define
the event category using the
Define the individual events for each event category, including all of
the necessary attributes.
A basic event example:
<event event="0x01" title="Cache" name="Instruction refill" description="Instruction fetch that causes a refill of at least the level of instruction or unified cache closest to the processor"/>
A fixed event example:
<event counter="ARM_Cortex-A9_ccnt" title="Clock" name="Cycles" display="hertz" units="Hz" average_selection="yes" description="The number of core clock cycles"/>
- Create a new XML file in the same directory as the makefile before building
gatordafter you create your new XML file.