Previous section.

Systems Management: Application Response Measurement (ARM) API
Copyright © 1998 The Open Group

<arm.h> Header File

A C language header file, <arm.h>, is supplied for applications written in either C or C++. If you are using a language other than C or C++, the data structures and external references need to be translated to the language you are using. Note that not all hardware systems or compilers provide native support for 64-bit integers, nor is there yet a standard type declaration for them. For these reasons the distributed version of the <arm.h> header file does not assume native support for 64 bit integers. However, the symbol "INT64" can be defined near the front of the file to customize the header for compilers and systems with 64 bit integer support.

#ifndef ARM_H_INCLUDED
#define ARM_H_INCLUDED

/**************************************************************/
/* arm.h - ARM API Definitions                                */
/**************************************************************/

#include <sys/types.h>              /* C types definitions */

/* Type definitions for various field sizes */
/* 64-bit integer compiler support: */
/* If a type declaration supporting 64 bit integer arithmetic */
/* is defined for the target platform and compiler, the       */
/* "INT64" #define should be set to that type declaration.    */
/* E.g.,                                                      */
/*         #define INT64 long long                            */
/* If 64 bit arithmetic is not supported on the target        */
/* platform or compiler, remove (or comment out) the "INT64"  */
/* #define and structures of two 32 bit values will be        */
/* defined for the 64 bit fields.                             */

/*** #define INT64 long long ***/

typedef unsigned char bit8 ;
typedef short int16 ;
typedef long int32 ;
typedef unsigned char unsigned8 ;
typedef unsigned short unsigned16 ;
typedef unsigned long unsigned32 ;

#ifdef INT64
typedef INT64 int64 ;
typedef unsigned INT64 unsigned64 ;
#else
typedef struct int64 {
    int32     upper;
    int32     lower;
} int64 ;

typedef struct unsigned64 {
    unsigned32     upper;
    unsigned32     lower;}
unsigned64 ;
#endif

/*** Symbol definitions ***/

/* Enumeration of transaction status completion codes */

enum arm_tran_status_e { ARM_GOOD = 0, ARM_ABORT, ARM_FAILED };

/* Enumeration of user data formats */

enum arm_userdata_e { ARM_Format1 = 1, ARM_Format2, 
                          ARM_Format101 = 101 };

/* Enumeration of metric types */

typedef enum arm_metric_type_e {
   ARM_Counter32 = 1, ARM_Counter64, ARM_CntrDivr32,
   ARM_Gauge32, ARM_Gauge64, ARM_GaugeDivr32, ARM_NumericID32,
   ARM_NumericID64, ARM_String8, ARM_String32,
   ARM_MetricTypeLast
} arm_metric_type_e;

/*** Data definitions ***/

/* User metric structures */

typedef struct arm_cntrdivr32_t {   /* Counter32 + Divisor32 */
    unsigned32 count;
    unsigned32 divisor;
} arm_cntrdivr32_t;

typedef struct arm_gaugedivr32_t {  /* Gauge32 + Divisor32   */
   int32 gauge;
    unsigned32 divisor;
} arm_gaugedivr32_t;

/* Union of user ARM_Format1 metric types */

typedef union arm_user_metric1_u {
    unsigned32   counter32;           /* Counter32 */
    unsigned64   counter64;           /* Counter64 */
    arm_cntrdivr32_t cntrdivr32;      /* Counter32 + Divisor32 */
    int32        gauge32;             /* Gauge32 */
    int64        gauge64;             /* Gauge64 */
    arm_gaugedivr32_t gaugedivr32;    /* Gauge32 + Divisor32 */
    unsigned32   numericid32;         /* NumericID32 */
    unsigned64   numericid64;         /* NumericID64 */
    char         string8[8];          /* String8 */
} arm_user_metric1_u;

/* Application view of correlator */

typedef struct arm_app_correlator_t {
    int16        length;           /* Length of the correlator   */
    char         agent_data[166];  /* Agent-specific data fields */
} arm_app_correlator_t;

/* User metrics ARM_Format1 structure definition */

typedef struct arm_user_data1_t {
    int32        format;       /* Version/format id (userdata_e) */
    bit8         flags[4];     /* Flags for metrics' presence    */
    arm_user_metric1_u metric[6];     /* User metrics            */
    char         string32[32];        /* 32 byte non-terminated  */
                                      /* string                  */
    arm_app_correlator_t correlator;  /* Correlator              */
} arm_user_data1_t;

/* User metrics ARM_Format2 structure definition */

typedef struct arm_user_data2_t {
    int32        format;       /* Version/format id (userdata_e) */
    char         string1020[1020];      /* 1020 byte opaque blob */
} arm_user_data2_t;

/* User metric meta-data for ARM_Format101 structure */

typedef struct arm_user_meta101_t {
    int32        type;     /* Type of metric (arm_user_metric_e) */
    char         name[44]; /* NULL-terminated string <= 44 char  */
} arm_user_meta101_t;

/* User meta-data ARM_Format101 structure definition */

typedef struct arm_user_data101_t {
    int32        format;       /* Version/format id (userdata_e) */
    bit8         flags[4]; /* Flags for which fields are present */
arm_user_meta101_t meta[7];    /* User metrics meta-data         */
} arm_user_data101_t;

/* Flag bit definitions (within bit8 fields)                     */

/* flags[0] in arm_user_data1_t passed in arm_start              */

#define ARM_CorrPar_f 0x80   /* Correlator from parent           */
#define ARM_CorrReq_f 0x40   /* Request correlator generation    */
#define ARM_CorrGen_f 0x20   /* New correlator generated in data */
#define ARM_TraceReq_f 0x10  /* User trace request               */

/* flags[1] in arm_user_data101_t passed in arm_get_id and       */
/* flags[1] in arm_user_data1_t passed in arm_start, arm_update  */
/* and arm_end */

#define ARM_Metric1_f 0x80     /* Metric 1 present    */
#define ARM_Metric2_f 0x40     /* Metric 2 present    */
#define ARM_Metric3_f 0x20     /* Metric 3 present    */
#define ARM_Metric4_f 0x10     /* Metric 4 present    */
#define ARM_Metric5_f 0x08     /* Metric 5 present    */
#define ARM_Metric6_f 0x04     /* Metric 6 present    */
#define ARM_AllMetrics_f 0xfc  /* Metrics 1-6 present */
#define ARM_String1_f 0x02     /* String 1 present    */

#if defined _WIN32
    #include <windows.h>
    #define ARM_API WINAPI
#elif defined __OS2__
    #define ARM_API _Pascal
#elif defined _OS216
    #define arm_data_t char _far
    #define arm_ptr_t char _far
    #define ARM_API _far _pascal
#elif defined _WIN16 || _WINDOWS
    #include <windows.h>
    typedef BOOL (FAR PASCAL _export * FPSTRCB) (LPSTR, LPVOID);
    #define arm_data_t char FAR
    #define arm_ptr_t char FAR
    #define ARM_API WINAPI
#else          /* unix         */
    #define ARM_API
#endif

#ifdef __cplusplus
extern "C" {
#endif         /* __cplusplus */

#ifdef _PROTOTYPES

/*** Function prototypes ***/

extern int32 ARM_API arm_init(
    char* appl_name,     /* application name */
    char* appl_user_id,  /* Name of the application user */
    int32 flags,         /* Reserved = 0 */
    char* data,          /* Reserved = NULL */
    int32 data_size);    /* Reserved = 0 */

extern int32 ARM_API arm_getid(
    int32 appl_id,       /* application handle */
    char* tran_name,     /* transaction name */
    char* tran_detail,   /* transaction additional info */
    int32 flags,         /* Reserved = 0 */
    char* data,          /* format definition of user metrics */
    int32 data_size);    /* length of data buffer */

extern int32 ARM_API arm_start(
    int32 tran_id,       /* transaction name identifier */
    int32 flags,         /* Reserved = 0 */
    char* data,          /* user metrics data */
    int32 data_size);    /* length of data buffer */

extern int32 ARM_API arm_update(
    int32 start_handle,  /* unique transaction handle */
    int32 flags,         /* Reserved = 0 */
    char* data,          /* user metrics data */
    int32 data_size);    /* length of data buffer */

extern int32 ARM_API arm_stop(
    int32 start_handle,  /* unique transaction handle */
    int32 tran_status,   /* Good=0, Abort=1, Failed=2 */
    int32 flags,         /* Reserved = 0 */
    char* data,          /* user metrics data */
    int32 data_size);    /* length of data buffer */

extern int32 ARM_API arm_end(
    int32 appl_id,       /* application id */
    int32 flags,         /* Reserved = 0 */
    char* data,          /* Reserved = NULL */
    int32 data_size);    /* Reserved = 0 */

#else         /* _PROTOTYPES */

extern int32 ARM_API arm_init();
extern int32 ARM_API arm_getid();
extern int32 ARM_API arm_start();
extern int32 ARM_API arm_update();
extern int32 ARM_API arm_stop();
extern int32 ARM_API arm_end();

#endif        /* _PROTOTYPES */

#ifdef __cplusplus
}
#endif /* __cplusplus */

/* Type definitions for compatibility with version 1.0 of */
/* the ARM API                                            */

typedef     int32 arm_appl_id_t;

typedef     int32 arm_tran_id_t;

typedef     int32 arm_start_handle_t;

typedef     unsigned32 arm_flag_t;

typedef     char arm_data_t;

typedef     int32 arm_data_sz_t;

typedef     char arm_ptr_t;

typedef     int32 arm_ret_stat_t;

typedef     int32 arm_status_t;

#endif     /* ARM_H_INCLUDED */



Why not acquire a nicely bound hard copy?
Click here to return to the publication details or order a copy of this publication.

Contents Next section Index