arm_register_transaction

Langue: en

Autres versions - même langue

Version: August 2008 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

NAME

arm_register_transaction - describe transaction

SYNOPSIS

#include <arm4.h>

arm_error_t
arm_register_transaction(

    const arm_id_t *
app_id

    const arm_char_t *
tran_name

    const arm_id_t *
input_tran_id

    const arm_int32_t 
flags,

    const arm_buffer4_t *
buffer4,

    arm_id_t *
output_tran_id); 

DESCRIPTION

arm_register_transaction() describes metadata about a transaction.
  The application uses arm_register_transaction() to inform the ARM library of metadata about the transaction measured by the application. This metadata does not change from one application instance to another. It is the equivalent of the ARM 2.0 call arm_getid().
  ARM generates an ID that is passed in to arm_start_transaction() and arm_report_transaction().

app_id is an application ID returned from an arm_register_application() call in the same process.

buffer4 is a pointer to the user data buffer, if any. If the pointer is null (ARM_BUF4_NONE), there is no buffer. The sub-buffers that may be used are arm_subbuffer_metric_bindings_t and arm_subbuffer_tran_identity_t.
  The names of any transaction context properties are supplied in the arm_subbuffer_tran_identity_t sub-buffer. They do not change afterwards; that is, the names are immutable. The transaction context values may change with each arm_start_transaction() or arm_report_transaction().
  flags contains 32-bit flags. No values are currently defined. The field should be zero (ARM_FLAG_NONE).
  input_tran_id is a pointer to an optional 128-bit ID (16 bytes) that is unique and that can be treated as an alias for the other metadata. It can be any value except all zeros or all ones. If the pointer is null (ARM_ID_NONE), no ID is provided.
  An ID is unique if the probability of the ID being associated with more than one set of metadata is vanishingly small. The selection of 128-bit IDs yields 3.4 x 10**38 unique IDs, so the objective is to select an ID that makes use of all 128 bits and is reasonably likely to not be selected by another person creating an ID of the same form. Two suggested algorithms that generate 128-bit values with these characteristics are:
 

1.
The Universal Unique Identifier (UUID) algorithm that is part of The Open Group specification: DCE 1.1: Remote Procedure Call. A developer could use the algorithm at the time the application is developed using a utility on his or her system, and be reasonably certain that nobody else would generate the same 128-bit ID.
 
2.
The MD5 Message-Digest Algorithm, described in IETF RFC 1321. Applying this algorithm to a concatenation of all the metadata properties would almost certainly result in a value that would not collide with any other ID created with a different set of metadata properties. If an ARM implementation is passed an ID that was previously registered within this process, the implementation can ignore the other metadata parameters and assume they are identical to the previously registered metadata. The transaction metadata consists of the following fields: app_id, tran_name, and the arm_subbuffer_metric_bindings_t and arm_subbuffer_tran_identity_t sub-buffers passed in buffer4.

output_tran_id is a pointer to a 16-byte field. ARM will store a 16-byte value. There are no requirements on the value it is set to, except that it must be possible to pass it on other calls, such as arm_start_transaction(), without the application needing to do any error checking.

tran_name is a pointer to a null-terminated string containing the name of the transaction. Each transaction registered by an application must have a unique name. The maximum length of the string is 128 characters, including the termination character. It serves no purpose and is illegal to make this call if the pointer is null. The name should not contain trailing blank characters or consist of only blank characters.

RETURN VALUE

On success, the function returns ARM_SUCCESS. A non-zero value indicates an error.

ERRORS

If the return code is negative, an error occurred. If the return code is not negative, an error may or may not have occurred - the determination of what is an error and whether an error code is returned is at the discretion of the ARM implementation. The application can test the return code if it wants to provide its own error logging.

The following errors are recognized by this implementation, but may not be portable to other implementations:

ARM_FAILURE_NULL_ARGUMENT
The output_tran_id pointer must not be null.
ARM_FAILURE_INVALID_ARGUMENT
The tran_name argument doesn't match the string requirements.
ARM_FAILURE_BAD_ALIAS
The alias provided contains all 0's or all 1's.
ARM_FAILURE_DUPLICATE_ALIAS
The alias provided already refers to a transaction with different metadata. ARM_FAILURE_INTERNAL_ERROR An internal error has occurred that prevented the operation from completing. Check your system log for more details.

CONFORMING TO

ARM Issue 4.0 C Language Bindings, Version 2

EXAMPLE

None.

SEE ALSO

arm_register_application(3), arm_report_transaction(3), arm_start_transaction(3)