Creating custom performance counters
In addition to the hardware-specific and Linux performance counters that you can configure using the Counter Configuration dialog box, the gator daemon and driver provide hooks that enable you to customize counters.
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.
NoteTo create your own counters, mimic the methods used in the gator_events_mmapped.c or any of the other gator_events_x files included with the gator source. You can locate all of the files provided by DS-5™ by selecting Help > ARM Extras... from the main menu.
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
building gatord. The makefile pulls in any file that begins with
events-, so create an XML file
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 gatord. The makefile pulls in any file that begins with events-, so create an XML file called events-
gatordafter you create your new XML file.