ARM 4.0 counter metric
[ARM 4.0 Metrics]
A counter is a monotonically increasing non-negative value up to its maximum possible value, at which point it wraps around to zero and starts again. More...
Data Structures | |
struct | arm_metric_cntrdivr32 |
32-bit integer plus a 32-bit divisor, used to simulate floating-point counter. More... | |
Typedefs | |
typedef arm_int32_t | arm_metric_counter32_t |
32-bit integer metric counter type | |
typedef arm_int64_t | arm_metric_counter64_t |
64-bit integer metric counter type | |
typedef struct arm_metric_cntrdivr32 | arm_metric_cntrdivr32_t |
32-bit integer plus a 32-bit divisor, used to simulate floating-point counter. |
Detailed Description
A counter is a monotonically increasing non-negative value up to its maximum possible value, at which point it wraps around to zero and starts again.
This is the IETF (Internet Engineering Task Force) RFC 1155 definition of a counter.
A counter should be used when it makes sense to sum up the values over an interval. Examples are bytes printed and records written. The values can also be averaged, maximums and minimums (per transaction) can be calculated, and other kinds of statistical calculations can be performed.
ARM supports three counter types:
Processing multiple values of the same counter
If a counter is used, its initial value must be set at the time of the arm_start_transaction() call. The difference between the value when the arm_start_transaction() executes and when the arm_stop_transaction() executes (or the value in the last arm_update_transaction() if no metric value is passed on arm_stop_transaction()) is the value attributed to this transaction. Similarly, the difference between successive or from the arm_update_transaction()'s, arm_start_transaction() to the first arm_update_transaction(), or from the last arm_update_transaction() to the arm_stop_transaction(), equals the value for the time period between the respective calls.
Here are three examples of how a counter would probably be used:
- The counter is set to zero at arm_start_transaction() and to some value at arm_stop_transaction() (or the last arm_update_transaction()). In this case, the application probably measured the value for this transaction and provided that value in the arm_stop_transaction(). The application always sets the value to zero at the arm_start_transaction() so the value at arm_stop_transaction() reflects both the difference from the arm_start_transaction() value and the absolute value. When using arm_report_transaction(), the value provided is equivalent to the difference between zero and the provided value.
- The counter is x1 at arm_start_transaction(), x2 at its corresponding arm_stop_transaction(), x2 at the next arm_start_transaction(), and x3 at its corresponding arm_stop_transaction(). In this case, the application is probably keeping a rolling counter. Perhaps this is a server application that counts the total workload. The application simply takes a snapshot of the counter at the start of a transaction and another snapshot at the end of the transaction. The agent determines the difference attributed to this transaction.
- The counter is x1 at arm_start_transaction(), x2 at arm_stop_transaction(), x3 (not equal to x2) at the next arm_start_transaction(), and x4 at its arm_stop_transaction(). In this case, the application is probably keeping a rolling counter as in the previous example. But in this case the measurement represents a value affected by other users or transaction classes, so the value often changes from one arm_stop_transaction() to the next arm_start_transaction() for the same transaction class.