Step 3 : ARM 4.0 C Hello World example

Description

Have registered our application data we can now register our transaction meta data:

  1. Registering a transaction is similar to registering an application. Therefore we first need an ID variable for our transaction type:
    arm_id_t tran_id;
  2. Now we can register our transaction meta data with the arm_register_transaction() call. We pass the following parameters:
    1. pointer to application ID under which the application was previously registered.
    2. our transaction name.
    3. ARM_ID_NONE - since the agent generates an ID for us.
    4. ARM_FLAG_NONE - there are no flags defined for this API call.
    5. ARM_BUF4_NONE - it is a simple example, so no optional data is passed.
    6. pointer to our tran_id variable where the agent stores the generated ID for our transaction type.

Code

01: #include <stdio.h>
02: #include "arm4.h"
03: 
04: int main(int argc, char *argv[])
05: {   
06:    arm_id_t app_id;
07:    arm_id_t tran_id;
08:    arm_register_application("HelloWorldApp", ARM_ID_NONE,
09:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
10:                              &app_id);
11:    arm_register_transaction(&app_id, "HelloWorldTran", ARM_ID_NONE,
12:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
13:                              &tran_id);
14:    printf("Hello world!\n");
15:    return 0;
16: }