| 1 | .\" Copyright (c) 2005-2008 David Carter <dcarter@arm4.org> and others. |
|---|
| 2 | .\" All rights reserved. This program and the accompanying materials |
|---|
| 3 | .\" are made available under the terms of the Eclipse Public License v1.0 |
|---|
| 4 | .\" which accompanies this distribution, and is available at |
|---|
| 5 | .\" http://www.eclipse.org/legal/epl-v10.html |
|---|
| 6 | .TH "arm_register_transaction" 3 "August 2008" "arm4.org" "ARM 4 Programmer's Manual" |
|---|
| 7 | .SH NAME |
|---|
| 8 | arm_register_transaction \- describe transaction |
|---|
| 9 | .SH SYNOPSIS |
|---|
| 10 | .B #include <arm4.h> |
|---|
| 11 | .sp |
|---|
| 12 | \fBarm_error_t |
|---|
| 13 | .br |
|---|
| 14 | arm_register_transaction( |
|---|
| 15 | .br |
|---|
| 16 | const arm_id_t *\fIapp_id\fB, |
|---|
| 17 | .br |
|---|
| 18 | const arm_char_t *\fItran_name\fB, |
|---|
| 19 | .br |
|---|
| 20 | const arm_id_t *\fIinput_tran_id\fB, |
|---|
| 21 | .br |
|---|
| 22 | const arm_int32_t \fIflags\fB, |
|---|
| 23 | .br |
|---|
| 24 | const arm_buffer4_t *\fIbuffer4\fB, |
|---|
| 25 | .br |
|---|
| 26 | arm_id_t *\fIoutput_tran_id\fB);\fR |
|---|
| 27 | .SH DESCRIPTION |
|---|
| 28 | \fBarm_register_transaction()\fR describes metadata about a transaction. |
|---|
| 29 | |
|---|
| 30 | The application uses \fBarm_register_transaction()\fR to inform the ARM library of metadata about |
|---|
| 31 | the transaction measured by the application. This metadata does not change from one application |
|---|
| 32 | instance to another. It is the equivalent of the ARM 2.0 call \fBarm_getid()\fR. |
|---|
| 33 | |
|---|
| 34 | ARM generates an ID that is passed in to \fBarm_start_transaction()\fR and \fBarm_report_transaction()\fR. |
|---|
| 35 | |
|---|
| 36 | \fIapp_id\fR is an application ID returned from an \fBarm_register_application()\fR call in the same |
|---|
| 37 | process. |
|---|
| 38 | |
|---|
| 39 | \fIbuffer4\fR is a pointer to the user data buffer, if any. If the pointer is null (\fBARM_BUF4_NONE\fR), |
|---|
| 40 | there is no buffer. The sub-buffers that may be used are |
|---|
| 41 | \fBarm_subbuffer_metric_bindings_t\fR and \fBarm_subbuffer_tran_identity_t\fR. |
|---|
| 42 | |
|---|
| 43 | The names of any transaction context properties are supplied in the |
|---|
| 44 | \fBarm_subbuffer_tran_identity_t\fR sub-buffer. They do not change afterwards; that |
|---|
| 45 | is, the names are immutable. The transaction context values may change with each |
|---|
| 46 | \fBarm_start_transaction()\fR or \fBarm_report_transaction()\fR. |
|---|
| 47 | |
|---|
| 48 | \fIflags\fR contains 32-bit flags. No values are currently defined. The field should be zero |
|---|
| 49 | (\fBARM_FLAG_NONE\fR). |
|---|
| 50 | |
|---|
| 51 | \fIinput_tran_id\fR is a pointer to an optional 128-bit ID (16 bytes) that is unique and that can be treated as |
|---|
| 52 | an alias for the other metadata. It can be any value except all zeros or all ones. If the |
|---|
| 53 | pointer is null (\fBARM_ID_NONE\fR), no ID is provided. |
|---|
| 54 | |
|---|
| 55 | An ID is unique if the probability of the ID being associated with more than one set |
|---|
| 56 | of metadata is vanishingly small. The selection of 128-bit IDs yields 3.4 x 10**38 |
|---|
| 57 | unique IDs, so the objective is to select an ID that makes use of all 128 bits and is |
|---|
| 58 | reasonably likely to not be selected by another person creating an ID of the same |
|---|
| 59 | form. Two suggested algorithms that generate 128-bit values with these |
|---|
| 60 | characteristics are: |
|---|
| 61 | |
|---|
| 62 | .IP 1. |
|---|
| 63 | The Universal Unique Identifier (UUID) algorithm that is part of The Open |
|---|
| 64 | Group specification: DCE 1.1: Remote Procedure Call. A developer could use the |
|---|
| 65 | algorithm at the time the application is developed using a utility on his or her |
|---|
| 66 | system, and be reasonably certain that nobody else would generate the same 128-bit |
|---|
| 67 | ID. |
|---|
| 68 | |
|---|
| 69 | .IP 2. |
|---|
| 70 | The MD5 Message\-Digest Algorithm, described in IETF RFC 1321. Applying |
|---|
| 71 | this algorithm to a concatenation of all the metadata properties would almost |
|---|
| 72 | certainly result in a value that would not collide with any other ID created with a |
|---|
| 73 | different set of metadata properties. |
|---|
| 74 | .P |
|---|
| 75 | If an ARM implementation is passed an ID that was previously registered within |
|---|
| 76 | this process, the implementation can ignore the other metadata parameters and |
|---|
| 77 | assume they are identical to the previously registered metadata. The transaction |
|---|
| 78 | metadata consists of the following fields: \fIapp_id\fR, \fItran_name\fR, and the |
|---|
| 79 | \fBarm_subbuffer_metric_bindings_t\fR and \fBarm_subbuffer_tran_identity_t\fR |
|---|
| 80 | sub-buffers passed in \fIbuffer4\fR. |
|---|
| 81 | |
|---|
| 82 | \fIoutput_tran_id\fR is a pointer to a 16-byte field. ARM will store a 16-byte value. There are no |
|---|
| 83 | requirements on the value it is set to, except that it must be possible to pass it on |
|---|
| 84 | other calls, such as \fBarm_start_transaction()\fR, without the application needing to do |
|---|
| 85 | any error checking. |
|---|
| 86 | |
|---|
| 87 | \fItran_name\fR is a pointer to a null-terminated string containing the name of the transaction. Each |
|---|
| 88 | transaction registered by an application must have a unique name. The maximum |
|---|
| 89 | length of the string is 128 characters, including the termination character. It serves |
|---|
| 90 | no purpose and is illegal to make this call if the pointer is null. The name should not |
|---|
| 91 | contain trailing blank characters or consist of only blank characters. |
|---|
| 92 | .SH "RETURN VALUE" |
|---|
| 93 | On success, the function returns \fBARM_SUCCESS\fR. A non-zero value indicates |
|---|
| 94 | an error. |
|---|
| 95 | .SH ERRORS |
|---|
| 96 | If the return code is negative, an error occurred. If the return code is not negative, an error may |
|---|
| 97 | or may not have occurred - the determination of what is an error and whether an error code is |
|---|
| 98 | returned is at the discretion of the ARM implementation. The application can test the return code |
|---|
| 99 | if it wants to provide its own error logging. |
|---|
| 100 | |
|---|
| 101 | The following errors are recognized by this implementation, but may not be portable to other implementations: |
|---|
| 102 | |
|---|
| 103 | .TP |
|---|
| 104 | .B ARM_FAILURE_NULL_ARGUMENT |
|---|
| 105 | The \fIoutput_tran_id\fR pointer must not be null. |
|---|
| 106 | .TP |
|---|
| 107 | .B ARM_FAILURE_INVALID_ARGUMENT |
|---|
| 108 | The \fItran_name\fR argument doesn't match the string requirements. |
|---|
| 109 | .TP |
|---|
| 110 | .TP |
|---|
| 111 | .B ARM_FAILURE_BAD_ALIAS |
|---|
| 112 | The alias provided contains all 0's or all 1's. |
|---|
| 113 | .TP |
|---|
| 114 | .B ARM_FAILURE_DUPLICATE_ALIAS |
|---|
| 115 | The alias provided already refers to a transaction with different metadata. |
|---|
| 116 | .B ARM_FAILURE_INTERNAL_ERROR |
|---|
| 117 | An internal error has occurred that prevented the operation from completing. Check your |
|---|
| 118 | system log for more details. |
|---|
| 119 | .SH "CONFORMING TO" |
|---|
| 120 | ARM Issue 4.0 C Language Bindings, Version 2 |
|---|
| 121 | .SH EXAMPLE |
|---|
| 122 | None. |
|---|
| 123 | .SH "SEE ALSO" |
|---|
| 124 | .BR arm_register_application (3), |
|---|
| 125 | .BR arm_report_transaction (3), |
|---|
| 126 | .BR arm_start_transaction (3) |
|---|