| 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_generate_correlator" 3 "August 2008" "arm4.org" "ARM 4 Programmer's Manual" |
|---|
| 7 | .SH NAME |
|---|
| 8 | arm_generate_correlator \- generate a correlator |
|---|
| 9 | .SH SYNOPSIS |
|---|
| 10 | .B #include <arm4.h> |
|---|
| 11 | .sp |
|---|
| 12 | \fBarm_error_t |
|---|
| 13 | .br |
|---|
| 14 | arm_generate_correlator( |
|---|
| 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_correlator_t *\fIcurrent_correlator\fB);\fR |
|---|
| 27 | .SH DESCRIPTION |
|---|
| 28 | \fBarm_generate_correlator()\fR is used to generate a correlator for use with |
|---|
| 29 | \fBarm_report_transaction()\fR. |
|---|
| 30 | |
|---|
| 31 | A correlator is a correlation token passed from a calling transaction to a called transaction. The |
|---|
| 32 | correlation token may be used to establish a calling hierarchy across processes and systems. A |
|---|
| 33 | correlator contains a two-byte length field, a one-byte format ID, a one-byte flag field, plus it |
|---|
| 34 | may contain other data that is used to uniquely identify an instance of a transaction. Applications |
|---|
| 35 | do not need to understand correlator internals. The maximum length is 512 |
|---|
| 36 | (\fBARM_CORR_MAX_LENGTH\fR) bytes. |
|---|
| 37 | |
|---|
| 38 | It is useful to think about its use in the context of what \fBarm_start_transaction()\fR and |
|---|
| 39 | \fBarm_stop_transaction()\fR do: |
|---|
| 40 | .IP * |
|---|
| 41 | \fBarm_start_transaction()\fR performs two functions. It establishes the identity of a transaction |
|---|
| 42 | instance (encapsulated in the current correlator) and begins the measurements of the |
|---|
| 43 | instance. \fBarm_stop_transaction()\fR causes the measurements to be captured. The start |
|---|
| 44 | handle links an \fBarm_start_transaction()\fR and an \fBarm_stop_transaction()\fR. |
|---|
| 45 | .IP * |
|---|
| 46 | \fBarm_generate_correlator()\fR establishes the identity of a transaction instance, like |
|---|
| 47 | \fBarm_start_transaction()\fR, also encapsulating it in a correlator. It has no relationship to |
|---|
| 48 | measurements about the transaction instance. \fBarm_report_transaction()\fR combines the |
|---|
| 49 | measurement function of both \fBarm_start_transaction()\fR and \fBarm_stop_transaction()\fR. |
|---|
| 50 | .P |
|---|
| 51 | Based on this positioning, it should be clear that \fBarm_generate_correlator()\fR can be used |
|---|
| 52 | whenever an \fBarm_start_transaction()\fR can be used. More specifically, the following calls must |
|---|
| 53 | have been executed first: \fBarm_register_application()\fR, \fBarm_register_transaction()\fR, and |
|---|
| 54 | \fBarm_start_application()\fR. The same parameters are also used, except there's no need for a start |
|---|
| 55 | handle, and there's no need for the arrival time or metric values sub-buffers. The other sub- |
|---|
| 56 | buffers may be used. The correlator that is output can be used in the same way that a correlator |
|---|
| 57 | output from \fBarm_start_transaction()\fR is used. |
|---|
| 58 | |
|---|
| 59 | \fIapp_handle\fR is a value returned from an \fBarm_start_application()\fR call in the same process. The |
|---|
| 60 | ARM implementation may use this handle to access application instance data that |
|---|
| 61 | may become part of the correlator; e.g., the \fBarm_subbuffer_system_address_t\fR. |
|---|
| 62 | |
|---|
| 63 | \fIbuffer4\fR is a pointer to the user data buffer, if any. If the pointer is null (\fBARM_BUF4_NONE\fR), |
|---|
| 64 | there is no buffer. The sub-buffers that may be used are |
|---|
| 65 | \fBarm_subbuffer_trancontext_t\fR, and \fBarm_subbuffer_user_t\fR. |
|---|
| 66 | |
|---|
| 67 | \fIcurrent_correlator\fR is a pointer to a buffer into which the ARM implementation will store a correlator for |
|---|
| 68 | the transaction instance, if any. The length of the buffer should be (at least) 512 |
|---|
| 69 | (\fBARM_CORR_MAX_LENGTH\fR). The value must be non-null. |
|---|
| 70 | |
|---|
| 71 | \fIflags\fR Contains 32-bit flags. These values may be combined using a binary or (|) operation. |
|---|
| 72 | .IP |
|---|
| 73 | 0x00000001 (\fBARM_FLAG_TRACE_REQUEST\fR) is present if the application |
|---|
| 74 | requests/suggests a trace. |
|---|
| 75 | .IP |
|---|
| 76 | 0x00000004 (\fBARM_FLAG_CORR_IN_PROCESS\fR) is present if the application is stating |
|---|
| 77 | that it will not send the correlator outside the current process. An ARM |
|---|
| 78 | implementation may be able to optimize correlator handling if it knows this, |
|---|
| 79 | because it may be able to avoid serialization to create the correlator. |
|---|
| 80 | .P |
|---|
| 81 | \fIparent_correlator\fR is a pointer to the parent correlator, if any. The pointer may be null |
|---|
| 82 | (\fBARM_CORR_NONE\fR). |
|---|
| 83 | |
|---|
| 84 | \fItran_id\fR is a transaction ID returned in an out parameter from an \fBarm_register_transaction()\fR |
|---|
| 85 | call in the same process. |
|---|
| 86 | .SH "RETURN VALUE" |
|---|
| 87 | On success, the function returns \fBARM_SUCCESS\fR. A non-zero value indicates |
|---|
| 88 | an error. |
|---|
| 89 | .SH ERRORS |
|---|
| 90 | If the return code is negative, an error occurred. If the return code is not negative, an error may |
|---|
| 91 | or may not have occurred - the determination of what is an error and whether an error code is |
|---|
| 92 | returned is at the discretion of the ARM implementation. The application can test the return code |
|---|
| 93 | if it wants to provide its own error logging. |
|---|
| 94 | |
|---|
| 95 | The following errors are recognized by this implementation, but may not be portable to other implementations: |
|---|
| 96 | |
|---|
| 97 | .TP |
|---|
| 98 | .B ARM_FAILURE_NULL_ARGUMENT |
|---|
| 99 | The \fIcurrent_correlator\fR must not be null. |
|---|
| 100 | .SH "CONFORMING TO" |
|---|
| 101 | ARM Issue 4.0 C Language Bindings, Version 2 |
|---|
| 102 | .SH EXAMPLE |
|---|
| 103 | None. |
|---|
| 104 | .SH "SEE ALSO" |
|---|
| 105 | .BR arm_register_application (3), |
|---|
| 106 | .BR arm_register_transaction (3), |
|---|
| 107 | .BR arm_report_transaction (3), |
|---|
| 108 | .BR arm_start_application (3), |
|---|
| 109 | .BR arm_start_transaction (3), |
|---|
| 110 | .BR arm_stop_transaction (3) |
|---|