You copied the Doc URL to your clipboard.

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.

Note

To 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:

Procedure

  1. Create an empty gator_events_your_custom.c file or duplicate gator_events_mmapped.c.
  2. Update the makefile to build the new gator_events_your_custom.c file.
  3. Add the preprocessor directive #include "gator.h" if you do not use gator_events_mmapped.c as a template.
  4. Implement the following functions in your new source file: gator_events_your_custom_init, gator_events_your_custom_interface, gator_events_your_custom_create_files, gator_events_your_custom_start, gator_events_your_custom_read, and gator_events_your_custom_stop.
  5. Add gator_events_your_custom_init to GATOR_EVENTS_LIST in gator_main.c.
  6. All of your new counters must be added to the events list. To do this:
    1. 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-YourCustom.xml.
    2. 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"/>
    3. For each counter set, you must list each of the possible events. Define the event category using the <category> tag.
    4. 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"/>
  7. Re-build gatord after you create your new XML file.
Was this page helpful? Yes No