cakelab
Home Projects Research Misc. Contact

Carm

Automatic ARM Instrumentation for C Source Code

~2006


This is a C library for automatic ARM instrumentation of C/(C++) code.

The C/C++ compiler of the GNU compiler collection (GCC) provides automatic insertion of instrumentation code by a flag called -finstrument-functions. Using this flag, the compiler inserts instrumentation code before and after each function which calls either __cyg_profile_func_enter() or __cyg_profile_func_leave() (see [1] for a nice article on the GNU profiling functions). The application program can implement this function for any purpose - for example performance instrumentation for bottleneck analysis.

Exactly this purposes is the goal of the standard API for Application Response Measurement (ARM, [2]). A lot of management tools provide agents for this API to collect those data from different sources.

Therefore the idea was to bridge between GNU profiling functions and the ARM API. This library contains implementations of the profiling functions which gather and preprocess the information and forward it to the ARM 4 API.

FEATURES

  • Registers path and name of executed binary as ARM application.
  • Is reentrant - e.g. supports threaded applications.
  • Dynamically detects function names using dynamic loader interface and register functions as ARM transactions.
  • Supports ARM correlators indicating relationship between nested function calls for a thread.
  • Currently no support for distributed ARM transactions.

You can use the library for C++ source code too, but the class names are not considered.

AUTOMATIC INSTRUMENTATION

This section describes the steps to automatically instrument your C files.

Compile all files you want to insert instrumentation code with at least the following flags:

CFLAGS=-g -rdynamic -finstrument-functions

Link your binary with the following libraries:

LDFLAGS=-lcarm -ldl -lglib-2.0 -l<arm_agent_lib>

<arm_agent_lib> is an ARM agent library of your choice. In the ARM 4.0 SDK is an example library (libarm4logger.so) which simply logs all information to stdout. The ARM 4.0 SDK is bundled with this package.

Look into directory "example" for an example.

DEPENDENCIES

  • GNU Compiler Collection for the instrumentation capability.
  • GLib 2.0 for a hash table data structure.
  • Dynamic Linker Interface (dl) for dynamic lookup of symbols.

LINKS

  • [1] Visualise function calls with Graphviz
  • [2] Open GROUP, Application Response Measurement - ARM

LICENSE

This software is published under GNU Public License V3.

DOWNLOAD

Download the ARM 4.0 SDK for an example ARM agent.


Holger Machens, 02-Jan-2021