NV::Rules::IMetric

class IMetric

Metric interface.

Represents a single, named metric. A metric can carry one value or multiple, if it is an instanced metric.

Public Types

using Description = std::string
enum class MetricSubtype

Metric subtype.

Indicates the subtype of the metric. Subtypes only apply to hardware metrics. Other metric types have subtype None in Python.

Values:

enumerator NONE
enumerator PEAK_SUSTAINED
enumerator PEAK_SUSTAINED_ACTIVE
enumerator PEAK_SUSTAINED_ACTIVE_PER_SECOND
enumerator PEAK_SUSTAINED_ELAPSED
enumerator PEAK_SUSTAINED_ELAPSED_PER_SECOND
enumerator PEAK_SUSTAINED_FRAME
enumerator PEAK_SUSTAINED_FRAME_PER_SECOND
enumerator PEAK_SUSTAINED_REGION
enumerator PEAK_SUSTAINED_REGION_PER_SECOND
enumerator PER_CYCLE_ACTIVE
enumerator PER_CYCLE_ELAPSED
enumerator PER_CYCLE_IN_FRAME
enumerator PER_CYCLE_IN_REGION
enumerator PER_SECOND
enumerator PCT_OF_PEAK_SUSTAINED_ACTIVE
enumerator PCT_OF_PEAK_SUSTAINED_ELAPSED
enumerator PCT_OF_PEAK_SUSTAINED_FRAME
enumerator PCT_OF_PEAK_SUSTAINED_REGION
enumerator MAX_RATE
enumerator PCT
enumerator RATIO
enum class MetricType

Metric type.

Indicates the type of the metric. May take values COUNTER, RATIO or THROUGHPUT for hardware metrics, and OTHER for all other types (e.g. launch metrics, device attributes).

Values:

enumerator OTHER
enumerator COUNTER
enumerator RATIO
enumerator THROUGHPUT
enum class RollupOperation

Rollup Operation.

Indicates the type of operation that is used to accumulate multiple values of a given metric. May take values AVG, MAX, MIN and SUM, as well as None, if no such operation is specified.

Values:

enumerator NONE
enumerator AVG
enumerator MAX
enumerator MIN
enumerator SUM
using Unit = std::string
enum class ValueKind

Metric value kind.

Indicates the kind (or type) of a metric value, metric instance value or correlation ID.

Values:

enumerator UNKNOWN
enumerator ANY
enumerator STRING
enumerator FLOAT
enumerator DOUBLE
enumerator UINT32
enumerator UINT64

Public Functions

virtual double as_double() = 0

Get the metric value as double.

Get the metric value as double

virtual double as_double(size_t instance) = 0

Get a value from the metric instances as double.

Get the value of metric instance instance as double

virtual const char *as_string() = 0

Get the metric value as string.

Get the metric value as string

virtual const char *as_string(size_t instance) = 0

Get a value from the metric instances as string.

Get the value of metric instance instance as string

virtual uint64_t as_uint64() = 0

Get the metric value as 64bit integer.

Get the metric value as 64bit integer

virtual uint64_t as_uint64(size_t instance) = 0

Get a value from the metric instances as 64bit integer.

Get the value of metric instance instance as 64bit integer

virtual IMetric *correlation_ids() = 0

Get a metric object for this metric’s instance value’s correlation IDs.

Returns a new metric object representing the correlation IDs for the metric’s instance values. Use has_correlation_ids to check if this metric has correlation IDs for its instance values. Correlation IDs are used to associate instance values with the “instance” their value represents. In the returned new metric object, the correlation IDs are that object’s instance values.

virtual Description description() const = 0

Get the metric description.

Get a textual description of the metric

virtual bool has_correlation_ids() = 0

Check if the metric has correlation IDs.

If true, the metric has correlation IDs matching its instance values, which can be accessed using correlation_ids .

virtual bool has_value() = 0

Check if the metric has a non-instanced value.

Check if the metric has a non-instanced value. If true, the metric may still have instance values, too.

virtual bool has_value(ValueKind value_kind) = 0

Check if the metric has a non-instanced value of a specific kind.

Check if the metric has a value of a specific value_kind . If true, the metric may still have instance values, too.

virtual ValueKind kind() = 0

Get the metric value kind.

Get the metric value kind

virtual ValueKind kind(size_t instance) = 0

Get the metric value kind for an instance value.

Get the metric value kind for its instance value instance . num_instances can be used to check the total number of instance values.

virtual MetricSubtype metric_subtype() const = 0

Get the metric subtype.

Get the metric subtype

virtual MetricType metric_type() const = 0

Get the metric type.

Get the metric type

virtual const char *name() = 0

Get the metric name.

Get the metric name

virtual size_t num_instances() = 0

Get the number of instance values for this metric.

Get the number of instance values for this metric. Not all metrics have instance values. If a metric has instance values, it may also have correlation_ids matching these instance values.

virtual RollupOperation rollup_operation() const = 0

Get the type of rollup operation.

Get the type of rollup operation

virtual Unit unit() const = 0

Get the metric unit.

Get the metric unit

inline virtual ~IMetric()