| 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_metric" 3 "August 2008" "arm4.org" "ARM 4 Programmer's Manual" |
|---|
| 7 | .SH NAME |
|---|
| 8 | arm_register_metric \- describe metrics |
|---|
| 9 | .SH SYNOPSIS |
|---|
| 10 | .B #include <arm4.h> |
|---|
| 11 | .sp |
|---|
| 12 | \fBarm_error_t |
|---|
| 13 | .br |
|---|
| 14 | arm_register_metric( |
|---|
| 15 | .br |
|---|
| 16 | const arm_id_t *\fIapp_id\fB, |
|---|
| 17 | .br |
|---|
| 18 | const arm_char_t *\fIname\fB, |
|---|
| 19 | .br |
|---|
| 20 | const arm_metric_format_t \fIformat\fB, |
|---|
| 21 | .br |
|---|
| 22 | const arm_metric_usage_t \fIusage\fB, |
|---|
| 23 | .br |
|---|
| 24 | const arm_char_t *\fIunit\fB, |
|---|
| 25 | .br |
|---|
| 26 | const arm_id_t *\fIinput_metric_id\fB, |
|---|
| 27 | .br |
|---|
| 28 | const arm_int32_t \fIflags\fB, |
|---|
| 29 | .br |
|---|
| 30 | const arm_buffer4_t *\fIbuffer4\fB, |
|---|
| 31 | .br |
|---|
| 32 | arm_id_t *\fIoutput_metric_id\fB);\fR |
|---|
| 33 | .SH DESCRIPTION |
|---|
| 34 | \fBarm_register_metric()\fR describes metadata about a metric. |
|---|
| 35 | |
|---|
| 36 | The application uses \fBarm_register_metric()\fR to inform the ARM library of metadata about each |
|---|
| 37 | metric the application provides. |
|---|
| 38 | |
|---|
| 39 | ARM generates an ID that is passed in the metric binding sub-buffer to |
|---|
| 40 | \fBarm_register_transaction()\fR. |
|---|
| 41 | |
|---|
| 42 | \fIapp_id\fR is an application ID returned from an \fBarm_register_application()\fR call in the same |
|---|
| 43 | process. |
|---|
| 44 | |
|---|
| 45 | \fIbuffer4\fR is a pointer to the user data buffer, if any. If the pointer is null, there is no buffer. No |
|---|
| 46 | sub-buffer types are currently valid with this function call, so the pointer should be |
|---|
| 47 | null (\fBARM_BUF4_NONE\fR). |
|---|
| 48 | |
|---|
| 49 | \fIflags\fR contains 32-bit flags. No values are currently defined. The field should be zero |
|---|
| 50 | (\fBARM_FLAG_NONE\fR). |
|---|
| 51 | |
|---|
| 52 | \fIformat\fR describes the data type. The value must be one of the following values: |
|---|
| 53 | |
|---|
| 54 | .IP 1 |
|---|
| 55 | (\fBARM_METRIC_FORMAT_COUNTER32\fR) = arm_int32_t counter |
|---|
| 56 | .IP 2 |
|---|
| 57 | (\fBARM_METRIC_FORMAT_COUNTER64\fR) = arm_int64_t counter |
|---|
| 58 | .IP 3 |
|---|
| 59 | (\fBARM_METRIC_FORMAT_CNTRDIVR\fR) = arm_int32_t counter + arm_int32_t |
|---|
| 60 | divisor |
|---|
| 61 | .IP 4 |
|---|
| 62 | (\fBARM_METRIC_FORMAT_GAUGE32\fR) = arm_int32_t gauge |
|---|
| 63 | .IP 5 |
|---|
| 64 | (\fBARM_METRIC_FORMAT_GAUGE64\fR) = arm_int64_t gauge |
|---|
| 65 | .IP 6 |
|---|
| 66 | (\fBARM_METRIC_FORMAT_GAUGEDIVR32\fR) = arm_int32_t gauge + |
|---|
| 67 | arm_int32_t divisor |
|---|
| 68 | .IP 7 |
|---|
| 69 | (\fBARM_METRIC_FORMAT_NUMERICID32\fR) = arm_int32_t numeric ID |
|---|
| 70 | .IP 8 |
|---|
| 71 | (\fBARM_METRIC_FORMAT_NUMERICID64\fR) = arm_int64_t numeric ID |
|---|
| 72 | .IP 9 |
|---|
| 73 | deprecated |
|---|
| 74 | .IP 10 |
|---|
| 75 | (\fBARM_METRIC_FORMAT_STRING32\fR) = string (null-terminated) of a |
|---|
| 76 | maximum length of 32 characters (33 including the null termination character) |
|---|
| 77 | .P |
|---|
| 78 | \fIinput_metric_id\fR is a pointer to an optional 128-bit ID (16 bytes) that is unique and that can be treated as |
|---|
| 79 | an alias for the other metadata. It can be any value except all zeros or all ones. If the |
|---|
| 80 | pointer is null (\fBARM_ID_NONE\fR), no ID is provided. |
|---|
| 81 | |
|---|
| 82 | An ID is unique if the probability of the ID being associated with more than one set |
|---|
| 83 | of metadata is vanishingly small. The selection of 128-bit IDs yields 3.4 x 10**38 |
|---|
| 84 | unique IDs, so the objective is to select an ID that makes use of all 128 bits and is |
|---|
| 85 | reasonably likely to not be selected by another person creating an ID of the same |
|---|
| 86 | form. Two suggested algorithms that generate 128-bit values with these |
|---|
| 87 | characteristics are: |
|---|
| 88 | |
|---|
| 89 | .IP 1. |
|---|
| 90 | The Universal Unique Identifier (UUID) algorithm that is part of The Open |
|---|
| 91 | Group specification: DCE 1.1: Remote Procedure Call. A developer could use the |
|---|
| 92 | algorithm at the time the application is developed using a utility on his or her |
|---|
| 93 | system, and be reasonably certain that nobody else would generate the same 128-bit |
|---|
| 94 | ID. |
|---|
| 95 | |
|---|
| 96 | .IP 2. |
|---|
| 97 | The MD5 Message-Digest Algorithm, described in IETF RFC 1321. Applying |
|---|
| 98 | this algorithm to a concatenation of all the metadata properties would almost |
|---|
| 99 | certainly result in a value that would not collide with any other ID created with a |
|---|
| 100 | different set of metadata properties. |
|---|
| 101 | .P |
|---|
| 102 | If an ARM implementation is passed an ID that was previously registered within |
|---|
| 103 | this process, the implementation can ignore the other metadata parameters and |
|---|
| 104 | assume they are identical to the previously registered metadata. The metric |
|---|
| 105 | metadata consists of the following fields: \fIapp_id\fR, \fIname\fR, \fIformat\fR, \fIusage\fR, and \fIunit\fR. |
|---|
| 106 | |
|---|
| 107 | \fIname\fR is a pointer to a null-terminated string containing the name of the metric. The maximum |
|---|
| 108 | length of the string is 128 characters, including the termination character. It serves |
|---|
| 109 | no purpose and is illegal to make this call if the pointer is null. The name should not |
|---|
| 110 | contain trailing blank characters or consist of only blank characters. |
|---|
| 111 | |
|---|
| 112 | The name can be any string, with one exception. Strings beginning with the four |
|---|
| 113 | characters "ARM:" are reserved for the ARM specification. The specification will |
|---|
| 114 | define names with known semantics using this prefix. One name format is currently |
|---|
| 115 | defined. Any name beginning with the eight character prefix "ARM:CIM:" |
|---|
| 116 | represents a name defined using the DMTF CIM (Distributed Management Task |
|---|
| 117 | Force Common Information Model) naming rules. For example, |
|---|
| 118 | "ARM:CIM:CIM_SoftwareElement.Name" indicates that the metric value has the |
|---|
| 119 | semantics of the Name property of the CIM_SoftwareElement class. It is anticipated |
|---|
| 120 | that additional naming semantics are likely to be added in the future. |
|---|
| 121 | |
|---|
| 122 | \fIoutput_metric_id\fR is a pointer to a 16-byte field. ARM will store a 16-byte value. There are no |
|---|
| 123 | requirements on the value it is set to, except that it must be possible to pass it in the |
|---|
| 124 | metric binding sub-buffer on the \fBarm_register_transaction()\fR call, without the |
|---|
| 125 | application needing to do any error checking. |
|---|
| 126 | |
|---|
| 127 | \fIunit\fR is a pointer to a null-terminated string containing the units (such as "files transferred") |
|---|
| 128 | of the metric. The maximum length of the string is 128 characters, including the |
|---|
| 129 | termination character. The pointer may be null. |
|---|
| 130 | |
|---|
| 131 | \fIusage\fR describes how the metric is used. The value must be one of the following values, or |
|---|
| 132 | a negative value (any negative value is specific to the application; the negative |
|---|
| 133 | values are not expected to be widely used). |
|---|
| 134 | |
|---|
| 135 | .IP 0 |
|---|
| 136 | (\fBARM_METRIC_USE_GENERAL\fR) = a metric without a specified usage. Most |
|---|
| 137 | metrics are described with a GENERAL usage. |
|---|
| 138 | .IP 1 |
|---|
| 139 | (\fBARM_METRIC_USE_TRAN_SIZE\fR) = a metric that indicates the "size" of a |
|---|
| 140 | transaction. The "size" is something that would be expected to affect the response |
|---|
| 141 | time, such as the number of bytes in a file transfer or the number of files backed up |
|---|
| 142 | by a "backup" transaction. ARM implementations can use this knowledge to better |
|---|
| 143 | interpret the response time. |
|---|
| 144 | .IP 2 |
|---|
| 145 | (\fBARM_METRIC_USE_TRAN_STATUS\fR) = a metric that further explains the |
|---|
| 146 | transaction status passed on \fBarm_stop_transaction()\fR, such as a sense code that |
|---|
| 147 | explains why a transaction failed. |
|---|
| 148 | .SH "RETURN VALUE" |
|---|
| 149 | On success, the function returns \fBARM_SUCCESS\fR. A non-zero value indicates |
|---|
| 150 | an error. |
|---|
| 151 | .SH ERRORS |
|---|
| 152 | If the return code is negative, an error occurred. If the return code is not negative, an error may |
|---|
| 153 | or may not have occurred - the determination of what is an error and whether an error code is |
|---|
| 154 | returned is at the discretion of the ARM implementation. The application can test the return code |
|---|
| 155 | if it wants to provide its own error logging. |
|---|
| 156 | |
|---|
| 157 | The following errors are recognized by this implementation, but may not be portable to other implementations: |
|---|
| 158 | |
|---|
| 159 | .TP |
|---|
| 160 | .B ARM_FAILURE_NULL_ARGUMENT |
|---|
| 161 | The \fIoutput_metric_id\fR pointer must not be null. |
|---|
| 162 | .TP |
|---|
| 163 | .B ARM_FAILURE_INVALID_ARGUMENT |
|---|
| 164 | One of \fIname\fR or \fIunit\fR is invalid. |
|---|
| 165 | .TP |
|---|
| 166 | .TP |
|---|
| 167 | .B ARM_FAILURE_BAD_ALIAS |
|---|
| 168 | The alias provided contains all 0's or all 1's. |
|---|
| 169 | .TP |
|---|
| 170 | .B ARM_FAILURE_DUPLICATE_ALIAS |
|---|
| 171 | The alias provided already refers to a metric with different metadata. |
|---|
| 172 | .B ARM_FAILURE_INTERNAL_ERROR |
|---|
| 173 | An internal error has occurred that prevented the operation from completing. Check your |
|---|
| 174 | system log for more details. |
|---|
| 175 | .SH "CONFORMING TO" |
|---|
| 176 | ARM Issue 4.0 C Language Bindings, Version 2 |
|---|
| 177 | .SH EXAMPLE |
|---|
| 178 | None. |
|---|
| 179 | .SH "SEE ALSO" |
|---|
| 180 | .BR arm_register_application (3), |
|---|
| 181 | .BR arm_register_transaction (3) |
|---|