| 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_start_transaction" 3 "August 2008" "arm4.org" "ARM 4 Programmer's Manual" |
|---|
| 7 | .SH NAME |
|---|
| 8 | arm_start_transaction \- start transaction |
|---|
| 9 | .SH SYNOPSIS |
|---|
| 10 | .B #include <arm4.h> |
|---|
| 11 | .sp |
|---|
| 12 | \fBarm_error_t |
|---|
| 13 | .br |
|---|
| 14 | arm_start_transaction( |
|---|
| 15 | .br |
|---|
| 16 | const arm_app_start_handle_t \fIapp_handle\fB, |
|---|
| 17 | .br |
|---|
| 18 | const arm_id_t *\fItran_id\fB, |
|---|
| 19 | .br |
|---|
| 20 | const arm_correlator_t *\fIparent_correlator\fB, |
|---|
| 21 | .br |
|---|
| 22 | const arm_int32_t \fIflags\fB, |
|---|
| 23 | .br |
|---|
| 24 | const arm_buffer4_t *\fIbuffer4\fB, |
|---|
| 25 | .br |
|---|
| 26 | arm_tran_start_handle_t *\fItran_handle\fB, |
|---|
| 27 | .br |
|---|
| 28 | arm_correlator_t *\fIcurrent_correlator\fB);\fR |
|---|
| 29 | .SH DESCRIPTION |
|---|
| 30 | \fBarm_start_transaction()\fR is used to indicate that a transaction is beginning execution. |
|---|
| 31 | |
|---|
| 32 | Call \fBarm_start_transaction()\fR just prior to a transaction beginning execution. |
|---|
| 33 | \fBarm_start_transaction()\fR signals the ARM library to start timing the transaction response time. |
|---|
| 34 | There is one exception: when \fBarm_get_arrival_time()\fR is used to get a start time before |
|---|
| 35 | \fBarm_start_transaction()\fR executes. See \fBarm_get_arrival_time()\fR to understand this usage. |
|---|
| 36 | |
|---|
| 37 | \fBarm_start_transaction()\fR is also the means to pass to ARM the correlation token (called a |
|---|
| 38 | "correlator" in ARM) from a caller \- the "parent" \- and to request a correlator that can be passed |
|---|
| 39 | to transactions called by this transaction. The correlation token may be used to establish a calling |
|---|
| 40 | hierarchy across processes and systems. A correlator contains a two-byte length field, a one-byte |
|---|
| 41 | format ID, a one-byte flag field, plus it may contain other data that is used to uniquely identify |
|---|
| 42 | an instance of a transaction. Applications do not need to understand correlator internals. The |
|---|
| 43 | maximum length of a correlator is 512 (\fBARM_CORR_MAX_LENGTH\fR) bytes. (In ARM 2.0 it |
|---|
| 44 | was 168 bytes.) |
|---|
| 45 | |
|---|
| 46 | \fIapp_handle\fR is a handle returned in an out parameter from an \fBarm_start_application()\fR call in the |
|---|
| 47 | same process. |
|---|
| 48 | |
|---|
| 49 | \fIbuffer4\fR is a pointer to the user data buffer, if any. If the pointer is null (\fBARM_BUF4_NONE\fR), |
|---|
| 50 | there is no buffer. The sub-buffers that may be used are |
|---|
| 51 | \fBarm_subbuffer_arrival_time_t\fR, \fBarm_subbuffer_metric_values_t\fR, |
|---|
| 52 | \fBarm_subbuffer_tran_context_t\fR, and \fBarm_subbuffer_user_t\fR. |
|---|
| 53 | |
|---|
| 54 | \fIcurrent_correlator\fR is a pointer to a buffer into which the ARM implementation will store a correlator for |
|---|
| 55 | the transaction instance, if any. The length of the buffer should be (at least) 512 |
|---|
| 56 | (\fBARM_CORR_MAX_LENGTH\fR) bytes. |
|---|
| 57 | |
|---|
| 58 | If the pointer is null (\fBARM_CORR_NONE\fR), the application is not requesting that a |
|---|
| 59 | correlator be created. |
|---|
| 60 | |
|---|
| 61 | If the pointer is not null, the application is requesting that a correlator be created. In |
|---|
| 62 | this case the ARM implementation may (but need not) create a correlator in the |
|---|
| 63 | buffer. It may not create a correlator if it does not support the function or if it is |
|---|
| 64 | configured to not create a correlator. |
|---|
| 65 | |
|---|
| 66 | After \fBarm_start_transaction()\fR completes, the application tests the length field using |
|---|
| 67 | \fBarm_get_correlator_length()\fR to determine whether a correlator has been stored. If |
|---|
| 68 | the length is still zero, no correlator has been stored. The ARM implementation |
|---|
| 69 | must store zero in the length field if it does not generate a correlator. |
|---|
| 70 | |
|---|
| 71 | \fIflags\fR contains 32-bit flags. These may be combined using a binary or (|) operation. Three flags are defined: |
|---|
| 72 | |
|---|
| 73 | .IP 0x00000001 |
|---|
| 74 | (\fBARM_FLAG_TRACE_REQUEST\fR) is set if the application |
|---|
| 75 | requests/suggests a trace. |
|---|
| 76 | |
|---|
| 77 | .IP 0x00000002 |
|---|
| 78 | (\fBARM_FLAG_BIND_THREAD\fR) is set if the started transaction is |
|---|
| 79 | bound to this thread. Setting this flag is equivalent to immediately calling |
|---|
| 80 | \fBarm_bind_thread()\fR after the \fBarm_start_transaction()\fR completes, except the timing |
|---|
| 81 | is a little more accurate and the extra call is avoided. |
|---|
| 82 | |
|---|
| 83 | .IP 0x00000004 |
|---|
| 84 | (\fBARM_FLAG_CORR_IN_PROCESS\fR) is set if the application is stating |
|---|
| 85 | that it will not send the correlator outside the current process. An ARM |
|---|
| 86 | implementation may be able to optimize correlator handling if it knows this, |
|---|
| 87 | because it may be able to avoid serialization to create the correlator. |
|---|
| 88 | .P |
|---|
| 89 | \fIparent_correlator\fR is a pointer to the parent correlator, if any. The pointer may be null |
|---|
| 90 | (\fBARM_CORR_NONE\fR). |
|---|
| 91 | |
|---|
| 92 | \fItran_handle\fR is a pointer to an \fBarm_int64_t\fR into which the ARM library will store the value of the |
|---|
| 93 | handle that will represent the transaction instance in all calls, up to and including |
|---|
| 94 | the \fBarm_stop_transaction()\fR that indicates that the instance has completed executing. |
|---|
| 95 | The scope of the handle is the process in which the \fBarm_start_transaction()\fR is |
|---|
| 96 | executed. |
|---|
| 97 | |
|---|
| 98 | There are no defined behaviors for the value returned \- it is implementation |
|---|
| 99 | defined. Note that the returned value will always be a value that the application can |
|---|
| 100 | use in future calls that take a handle [\fBarm_bind_thread()\fR, \fBarm_block_transaction()\fR, |
|---|
| 101 | \fBarm_stop_transaction()\fR, \fBarm_unbind_thread()\fR, \fBarm_unblock_transaction()\fR, and |
|---|
| 102 | \fBarm_update()\fR]. |
|---|
| 103 | |
|---|
| 104 | \fItran_id\fR is a transaction ID returned in an out parameter from an \fBarm_register_transaction()\fR |
|---|
| 105 | call in the same process. |
|---|
| 106 | |
|---|
| 107 | .SH "RETURN VALUE" |
|---|
| 108 | On success, the function returns \fBARM_SUCCESS\fR. A non-zero value indicates |
|---|
| 109 | an error. |
|---|
| 110 | .SH ERRORS |
|---|
| 111 | If the return code is negative, an error occurred. If the return code is not negative, an error may |
|---|
| 112 | or may not have occurred - the determination of what is an error and whether an error code is |
|---|
| 113 | returned is at the discretion of the ARM implementation. The application can test the return code |
|---|
| 114 | if it wants to provide its own error logging. |
|---|
| 115 | |
|---|
| 116 | The following errors are recognized by this implementation, but may not be portable to other implementations: |
|---|
| 117 | |
|---|
| 118 | .TP |
|---|
| 119 | .B ARM_FAILURE_NULL_ARGUMENT |
|---|
| 120 | The \fItran_handle\fR pointer must not be null. |
|---|
| 121 | .TP |
|---|
| 122 | .B ARM_FAILURE_INVALID_ARGUMENT |
|---|
| 123 | A valid \fItran_id\fR and \fIapp_handle\fR must be provided. |
|---|
| 124 | .TP |
|---|
| 125 | .B ARM_FAILURE_INTERNAL_ERROR |
|---|
| 126 | An internal error has occurred that prevented the operation from completing. Check your |
|---|
| 127 | system log for more details. |
|---|
| 128 | .SH "CONFORMING TO" |
|---|
| 129 | ARM Issue 4.0 C Language Bindings, Version 2 |
|---|
| 130 | .SH EXAMPLE |
|---|
| 131 | None. |
|---|
| 132 | .SH "SEE ALSO" |
|---|
| 133 | .BR arm_bind_thread (3), |
|---|
| 134 | .BR arm_block_transaction (3), |
|---|
| 135 | .BR arm_get_arrival_time (3), |
|---|
| 136 | .BR arm_get_correlator_length (3), |
|---|
| 137 | .BR arm_register_transaction (3), |
|---|
| 138 | .BR arm_start_application (3), |
|---|
| 139 | .BR arm_stop_transaction (3), |
|---|
| 140 | .BR arm_unbind_thread (3), |
|---|
| 141 | .BR arm_unblock_transaction (3), |
|---|
| 142 | .BR arm_update_transaction (3) |
|---|