cubos::core::Metrics class

Singleton class that manages a collection of metrics.

Public static functions

static void metric(const std::string& name, double metric)
Add a metric in the pool.
static auto size() -> std::size_t
Size of the metric pool.
static auto sizeByName(const std::string& name) -> std::size_t
Size of metrics associated with a given name.
static void clear()
Clears the metric pool.
static void setMaxEntries(std::size_t n)
Sets maximum metric entries.
static auto readValue(const std::string& name, double& value, size_t& offset) -> bool
Read a metric value by its name.
static auto readName(std::string& name, size_t& seenCount) -> bool
Search for a new unique metric name.

Constructors, destructors, conversion operators

Metrics() deleted
Deleted constructor.

Function documentation

static void cubos::core::Metrics::metric(const std::string& name, double metric)

Add a metric in the pool.

Parameters
name
metric The metric to add.

static std::size_t cubos::core::Metrics::size()

Size of the metric pool.

Returns Metrics count.

static std::size_t cubos::core::Metrics::sizeByName(const std::string& name)

Size of metrics associated with a given name.

Parameters
name Metric name.
Returns Metrics count.

static void cubos::core::Metrics::setMaxEntries(std::size_t n)

Sets maximum metric entries.

Parameters
n The new maximum value.

static bool cubos::core::Metrics::readValue(const std::string& name, double& value, size_t& offset)

Read a metric value by its name.

Parameters
name Metric name.
value out Buffer to store metric value.
offset Read count per metric.
Returns Whether the metric was found.

static bool cubos::core::Metrics::readName(std::string& name, size_t& seenCount)

Search for a new unique metric name.

Parameters
name out Buffer to store metric name.
seenCount Seen metrics count.
Returns Whether a new metric was found.