This class provides an in‐core value semantic type for recording and aggregating the values of a metric. The value of a Metric object is characterized by the Collector object it uses to collect metric‐event values. Each instance of this class establishes (at construction) an association to a Collector object to which the metric delegates. A Metric value is constant after construction (i.e., it does not support assignment or provide manipulators that modify its collector value) so that synchronization primitives are not required to protect its data members. Note that if a collector or metrics manager is not supplied at construction, and if the default metrics manager has not been instantiated, then the metric will be inactive (i.e., isActive() == false) and the manipulator methods of the metric object will have no effect.

Synopsis

Declared in <balm_metric.h>

class Metric;

Member Functions

Name

Description

Metric [constructor]

Constructors

accumulateCountTotalMinMax

Increase the event count by the specified count and add the specified total to the accumulated total; if the specified min is less than the current minimum recorded value of the metric, set the new minimum value to be min; if the specified max is greater than the current maximum recorded value, set the new maximum value to be max. If, however, this metric is inactive (i.e., isActive() is false), then this method has no effect.

collector

collector overloads

increment

Increase the count and total of this metric by 1; if 1.0 is less than the current minimum recorded value of the metric, set the new minimum value to be 1.0; if 1.0 is greater than the current maximum recorded value, set the new maximum value to be 1.0. If, however, this metric is not active (i.e., isActive() is false) then this method has no effect. Note that this method is functionally equivalent to update(1).

isActive

Return true if this metric will actively record metrics, and false otherwise. If the returned value is false, the manipulator operations will have no effect. A metric will be inactive if either (1) it was not initialized with a valid metric identifier or (2) the associated metric category has been disabled (see the MetricsManager method setCategoryEnabled). Note that invoking this method is logically equivalent to the expression 0 != collector() && metricId().category()‐>enabled().

metricId

Return a MetricId object identifying this metric. If this metric was not supplied a valid collector at construction then the returned id will be invalid (i.e., metricId().isValid() == false).

update

Increase the event count by 1 and add the specified value to the total recorded value; if value is less than the current minimum recorded value of the metric, set the new minimum value to be value; if value is greater than the current maximum recorded value, set the new maximum value to be value. If, however, this metric is inactive (i.e., isActive() is false), then this method has no effect.

Static Member Functions

Name

Description

lookupCollector

lookupCollector overloads

Non-Member Functions

Name

Description

operator!=

Return true if the specified lhs and rhs metrics do not have the same value and false otherwise. Two metrics do not have the same value if they record measurements using different collector objects or if one, but not both, have a null collector (i.e., collector() is 0).

operator==

Return true if the specified lhs and rhs metrics have the same value and false otherwise. Two metrics have the same value if they record measurements using the same collector object or if they both have a null collector (i.e., collector() is 0).

Created with MrDocs