Step 6 : ARM 4.0 C Hello World example

Description

The measurement of our transaction is executing now. But we also have to stop it after the Hello World line:

  1. To stop the transaction measurement we use the arm_stop_transaction() call. We pass the following parameters:
    1. pointer to transaction start handle we got from the ARM agent in the previous call to arm_start_transaction().
    2. ARM_STATUS_GOOD - Our transaction worked just fine.
    3. ARM_FLAG_NONE - we just ignore any flags for now.
    4. ARM_BUF4_NONE - it is a simple example, so no optional data is passed.

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_app_start_handle_t app_handle;
09:    arm_tran_start_handle_t tran_handle;
10:    arm_register_application("HelloWorldApp", ARM_ID_NONE,
11:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
12:                              &app_id);
13:    arm_register_transaction(&app_id, "HelloWorldTran", ARM_ID_NONE,
14:                              ARM_FLAG_NONE, ARM_BUF4_NONE,
15:                              &tran_id);
16:    arm_start_application(&app_id, "Tutorial", NULL,
17:                           ARM_FLAG_NONE, ARM_BUF4_NONE,
18:                           &app_handle);
19:    arm_start_transaction(app_handle, &tran_id, ARM_CORR_NONE,
20:                           ARM_FLAG_NONE, ARM_BUF4_NONE,
21:                           &tran_handle, ARM_CORR_NONE);
22:    printf("Hello world!\n");
23:    arm_stop_transaction(tran_handle, ARM_STATUS_GOOD, 
24:                          ARM_FLAG_NONE, ARM_BUF4_NONE);
25:    return 0;
26: }