Bindings

Contents / Enterprise Edition / User Guide / Agent / Bindings

Bindings

This section describes the ARM language bindings supported by MyARM. It provides a more detailed description of the MyARM set of ARM features.

ARM 4.0 C Binding

The ARM 4.0 C Binding published by The Open Group defines a C API to instrument applications to measure performance data. MyARM implements this API and can be used with any standard conforming instrumented application. This section does not describe the C API as it is published by The Open Group (see ARM4C for an API description), it describes the concrete implementation and special characteristics of MyARM.

C versus C++

The ARM 4.0 standard defines only a C API which can be used in C++ as well. The reason why there is no real C++ API is due to the fact how ARM is deployed within a system.

One major goal of ARM is that any application which is instrumented with a certain version of ARM should be able to run with any installed ARM agent of that version. But currently there does not exist any real application binary interface (ABI) standard for the C++ language. A compiler vendor can choose its own model how the compiler layouts objects or mangles class/method names to linker symbol names. So different ARM implementations could have different object layouts and different linker symbol names. This problem does not arise with plain ANSI-C programs.

ARM 4.0 C++ framework

However, MyARM provides a complete ARM 4.0 C++ framework using the ARM 4.0 C binding (See https://api.myarm.com/arm40cpp/). This framework is provided as source code which can be inlined or separately compiled. Therefore the ABI problem can be solved by the user of the ARM 4.0 C++ framework.

ARM 4.0 Optional features

In the ARM 4.0 document many features defined in the standard are marked as optional and may or may not be implemented by an agent. Besides the mandatory features MyARM supports the following optional features:

ARM 4.0 unsupported features

As described in the previous section many features are optional. Currently MyARM does not provide the following features:

Agent details

C Agent shared library architecture

The main part of the ARM agent is the shared library (object) which implements the ARM 4.0 C API. Each ARM instrumented application is linked against this library. The library base name is arm4 and for example libarm4.so is used under Linux platforms, whereas libarm4.dll, is used on Windows platforms.


Figure: Agent shared library overview

Figure "Agent shared library overview" also shows that the libarm4.so library in turn uses different datasink shared libraries which are loaded at runtime according to the current configuration. Here the mysql datasink library libmyarm_mysqlsink.so is shown which stores ARM data which originating in the libarm4.so library into a MySQL database.

Multi-threading versus Single-threading

The ARM 4.0 standard states that any ARM implementation has to be thread-safe. The MyARM implementation uses threads of their own to process measured data (Figure "Agent data processing thread pipeline"). Therefore if you use MyARM in a single-threaded program it is not really single-threaded but the interference between the instrumented application and the MyARM agent is reduced to a minimum regardless which configuration is used.

Response times

The ARM standard defines response times measured in nanoseconds. Not all systems today provide such a high granularity of time stamps. table Response time granularity shows on which platform MyARM provides which granularity of response time measurements.

Platform Granularity Description
Linux (x86, amd64) nanoseconds using clock_gettime() system call
Windows (x86, amd64) microseconds using GetSystemTimeAsFileTime() system call
Return codes

The ARM 4.0 C Binding describes that a negative return code for any of the API calls indicates an error, a zero return code a success and a positive return code a warning. The MyARM specific return codes are documented in the agent reference appendix.

Overhead

An overview of the performance impact by using the MyARM ARM 4.0 C Binding is documented in the appendix ARM 4.0 C Binding agent overhead.

ARM 4.0 Java Binding

The ARM 4.0 Java Binding published by The Open Group defines a complete set of Java interfaces to instrument applications to measure performance data. MyARM implements this API and can be used with any standard conforming instrumented application. This section does not describe the Java interfaces as it is published by The Open Group (see ARM4J for a interface description) it describes the concrete implementation and special characteristics of MyARM for Java. Read also the creating ARM object appendix in the agent reference.

JNI Implementation

The current implementation of the ARM 4.0 Java binding makes use of the MyARM C agent implementation using the Java native interface (JNI). Therefore all features and characteristics of the C implementation apply to the MyARM for Java agent. If there is a high demand for a Java native ARM 4.0 implementation we consider implementing such a native Java agent.

Overhead

An overview of the performance impact by using the MyARM ARM 4.0 Java Binding is documented in the appendix ARM 4.0 Java Binding agent overhead.

ARM 4.0 C# Binding

Currently no official ARM 4.0 C# binding exists from The Open Group. But the Eclipse project derived ARM 4.0 C# interfaces from the official ARM 4.0 Java binding. With version 1.2.0 MyARM supports this ARM 4.0 C# interface.

The MyARM implementation of the ARM 4.0 C# interfaces are completely written in C#. Only some of the datasinks will use the an external DLL using platform invoke. Currently the following datasinks are written entirely in C#:

All other datasinks are supported using our C implementation. Thus if you want 100% managed code you have to use the datasinks described above.

MyARM C# ARM 4.0 assembly

C# uses so-called assemblies as its library concept. Due to the fact that there is currently no official OpenGroup technical standard describing the language binding for C# MyARM provides two different assemblies:

  1. ARMInterface.dll -- Assembly which contains all interfaces of the ARM 4.0 C# binding.
  2. ARMImplementation.dll -- Assembly which contains the MyARM C# ARM 4.0 agent.

An application which wants to use ARM needs to load the correct implementation assembly. This can be done by the C# Assembly.Load() method or by specifying an external type with its assembly name and version and calling the Type.GetType() method. When the ARM implementation assembly was loaded successfully. The application needs to create the appropriate ARM factories as described in the creating ARM object appendix in the agent reference.

Response times

The ARM standard defines response times measured in nanoseconds. Not all systems today provide such a high granularity of time stamps. For the C# binding we use the Stopwatch class of the .NET framework to measure response times. This class supports high resolution timing if the underlying hardware supports high resolution timers. Therefore the granularity depends on the hardware used.

Overhead

An overview of the performance impact by using the MyARM ARM 4.0 C# Binding is documented in the appendix ARM 4.0 C# Binding agent overhead.

ARM 4.0 Python binding

The ARM 4.0 python language binding is not an official OpenGroup ARM 4.0 binding. It was developed by David Carter using the ARM 4.0 C binding. See http://www.arm4.org/. MyARM has integrated this good peace of software in its MyARM environment. All features of the ARM 4.0 C binding applies to the python binding by the fact it uses directly the libarm4 agent implementation.

ARM 4.0 Shell Binding

In fact "The ARM 4.0 Shell Binding" is not a real language binding but it consists out of some command line tools which uses the ARM 4.0 C language binding to enable ARM measurements within a shell script.

For more information please read the Shell instrumentation section.