Quick Links:

bal | bbl | bdl | bsl

Public Member Functions | Static Public Member Functions

balm::IntegerMetric Class Reference

#include <balm_integermetric.h>

List of all members.

Public Member Functions

 IntegerMetric (const char *category, const char *name, MetricsManager *manager=0)
 IntegerMetric (const MetricId &metricId, MetricsManager *manager=0)
 IntegerMetric (IntegerCollector *collector)
 IntegerMetric (const IntegerMetric &original)
void increment ()
void update (int value)
void accumulateCountTotalMinMax (int count, int total, int min, int max)
IntegerCollectorcollector ()
const IntegerCollectorcollector () const
MetricId metricId () const
bool isActive () const

Static Public Member Functions

static IntegerCollectorlookupCollector (const char *category, const char *name, MetricsManager *manager=0)
static IntegerCollectorlookupCollector (const MetricId &metricId, MetricsManager *manager=0)

Detailed Description

This class provides an in-core value semantic type for recording and aggregating the values of an integer metric. The value of a IntegerMetric object is characterized by the IntegerCollector object it uses to collect metric-event values. Each instance of this class establishes (at construction) an association to an IntegerCollector object to which the metric delegates. A IntegerMetric 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() is false) and the manipulator methods of the integer metric object will have no effect.

See Component balm_integermetric


Constructor & Destructor Documentation

balm::IntegerMetric::IntegerMetric ( const char *  category,
const char *  name,
MetricsManager manager = 0 
)

Create an integer metric object to collect values for the metric identified by the specified category and name. Optionally specify a metrics manager used to provide a collector for the indicated metric. If manager is 0, use the default metrics manager, if initialized; if manager is 0 and the default metrics manager has not been initialized, place this metric object in the inactive state (i.e., isActive() is false) in which case instance methods that would otherwise update the metric will have no effect. The behavior is undefined unless category and name are null-terminated.

balm::IntegerMetric::IntegerMetric ( const MetricId metricId,
MetricsManager manager = 0 
) [explicit]

Create an integer metric object to collect values for the specified metricId. Optionally specify a metrics manager used to provide a collector for metricId. If manager is 0, use the default metrics manager, if initialized; if manager is 0 and the default metrics manager has not been initialized, place this metric object in the inactive state (i.e., isActive() is false) in which case instance methods that would otherwise update the metric will have no effect. The behavior is undefined unless metricId is a valid id returned by the MetricRepository object owned by the indicated metrics manager.

balm::IntegerMetric::IntegerMetric ( IntegerCollector collector  )  [explicit]

Create an integer metric object to collect values for the metric implied by the specified collector (i.e., collector->metricId()). The behavior is undefined unless collector is a valid address of a IntegerCollector object and the collector object supplied has a valid id (i.e., collector->metricId().isValid()).

balm::IntegerMetric::IntegerMetric ( const IntegerMetric original  ) 

Create an integer metric object that will record values for the same metric (i.e., using the same IntegerCollector object) as the specified original integer metric. If the original metric is inactive (i.e., isActive() == false), then this metric will similarly be inactive.


Member Function Documentation

static IntegerCollector* balm::IntegerMetric::lookupCollector ( const char *  category,
const char *  name,
MetricsManager manager = 0 
) [static]

Return an integer collector corresponding to the specified metric category and name. Optionally specify a metrics manager used to provide the collector. If manager is 0, use the default metrics manager if initialized; if manager is 0 and the default metrics manager has not been initialized, return 0. The behavior is undefined unless category and name are null-terminated.

static IntegerCollector* balm::IntegerMetric::lookupCollector ( const MetricId metricId,
MetricsManager manager = 0 
) [static]

Return an integer collector for the specified metricId. Optionally specify a metrics manager used to provide the collector. If manager is 0, use the default metrics manager, if initialized; if manager is 0 and the default metrics manager has not been initialized, return 0. The behavior is undefined unless metricId is a valid metric id supplied by the MetricsRegistry of the indicated metrics manager.

void balm::IntegerMetric::increment (  ) 

Increase the count and total of this integer metric by 1; if 1 is less than the current minimum recorded value of the metric, set the new minimum value to be 1; if 1 is greater than the current maximum recorded value, set the new maximum value to be 1. If, however, this integer 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).

void balm::IntegerMetric::update ( int  value  ) 

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 integer metric is inactive (i.e., isActive() is false), then this method has no effect.

void balm::IntegerMetric::accumulateCountTotalMinMax ( int  count,
int  total,
int  min,
int  max 
)

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 integer metric is inactive (i.e., isActive() is false), then this method has no effect.

IntegerCollector* balm::IntegerMetric::collector (  ) 

Return the address of the modifiable integer collector for this integer metric.

const IntegerCollector* balm::IntegerMetric::collector (  )  const

Return the address of the non-modifiable integer collector for this integer metric.

MetricId balm::IntegerMetric::metricId (  )  const

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

bool balm::IntegerMetric::isActive (  )  const

Return true if this integer metric will actively record metrics, and false otherwise. If the returned value is false, the manipulator operations will have no effect. An integer 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().


The documentation for this class was generated from the following file: