2. Data Structures

Here are the data structures with brief descriptions:

NV::​Rules::​IAction
Action interface
NV::​Rules::​IContext
Context interface
NV::​Rules::​IController
Controller interface
NV::​Rules::​IEvaluator
Evaluator interface
NV::​Rules::​IFrontend
Frontend interface
NV::​Rules::​IMetric
Metric interface
NV::​Rules::​IRange
Range interface
NV::​Rules::​ISourceInfo
SourceInfo interface

2.1. NV::Rules::IAction Class Reference

[NvRules Python garbage-collected classes.]

Represents an activity such as a CUDA kernel on a single range, for which zero or more metrics were collected

Public Member Functions

virtual IMetricadd_double_metric ( const char* value_name, IMetric::​ValueKind value_kind, double  value ) =0
Add a single floating point metric to this action.
virtual IMetricadd_integer_metric ( const char* value_name, IMetric::​ValueKind value_kind, uint64_t value ) =0
Add a single integer metric to this action.
virtual IMetricadd_string_metric ( const char* value_name, IMetric::​ValueKind value_kind, const char* value ) =0
Add a single string metric to this action.
virtual IMetricmetric_by_name ( const char* metric_name ) =0
Get a single metric by name.
virtual const char* name ( ) =0
Get the action name.
virtual ISourceInfosource_info ( uint64_t address ) =0
Get the source info for a function address within this action.

Member Functions

virtual IMetric* NV::​Rules::​IAction::add_double_metric ( const char* value_name, IMetric::​ValueKind value_kind, double  value ) [inherited, pure virtual]
Add a single floating point metric to this action.
Returns

the new IMetric

Description

Add a single floating point metric with name value_name and kind value_kind to this action

virtual IMetric* NV::​Rules::​IAction::add_integer_metric ( const char* value_name, IMetric::​ValueKind value_kind, uint64_t value ) [inherited, pure virtual]
Add a single integer metric to this action.
Returns

the new IMetric

Description

Add a single integer metric to with name value_name and kind value_kind this action.

virtual IMetric* NV::​Rules::​IAction::add_string_metric ( const char* value_name, IMetric::​ValueKind value_kind, const char* value ) [inherited, pure virtual]
Add a single string metric to this action.
Returns

the new IMetric

Description

Add a single string metric with name value_name and kind value_kind to this action

virtual IMetric* NV::​Rules::​IAction::metric_by_name ( const char* metric_name ) [inherited, pure virtual]
Get a single metric by name.
Description

Get a single IMetric by metric_name

virtual const char* NV::​Rules::​IAction::name ( ) [inherited, pure virtual]
Get the action name.
Description

Get the action name

virtual ISourceInfo* NV::​Rules::​IAction::source_info ( uint64_t address ) [inherited, pure virtual]
Get the source info for a function address within this action.
Returns

a new ISourceInfo object if it is available

Description

Get the source info for address within this action. Addresses are commonly obtained as correlation ids of source-correlated metrics.

2.2. NV::Rules::IContext Class Reference

[NvRules Tool lifetime-managed classes.]

The rule context provides the rule with access to all collected data, properties and means to relay results back to the caller.

Public Member Functions

virtual IControllercontroller ( ) =0
Get the controller object.
virtual IFrontendfrontend ( ) =0
Get the frontend object.
virtual size_t num_ranges ( ) =0
Get the number of available ranges.
virtual IRangerange_by_idx ( size_t idx ) =0
Get a single range by index.

Member Functions

virtual IController* NV::​Rules::​IContext::controller ( ) [inherited, pure virtual]
Get the controller object.
Description

Get the IController object

virtual IFrontend* NV::​Rules::​IContext::frontend ( ) [inherited, pure virtual]
Get the frontend object.
Description

Get the IFrontend object

virtual size_t NV::​Rules::​IContext::num_ranges ( ) [inherited, pure virtual]
Get the number of available ranges.
Description

Get the number of available ranges

virtual IRange* NV::​Rules::​IContext::range_by_idx ( size_t idx ) [inherited, pure virtual]
Get a single range by index.
Description

Get a single IRange by index

2.3. NV::Rules::IController Class Reference

[NvRules Tool lifetime-managed classes.]

The controller can be used to interact with the tool runtime, e.g. to signal the tools to propose a follow-up rule.

Public Member Functions

virtual void propose_rule ( const char* rule ) =0

Member Functions

virtual void NV::​Rules::​IController::propose_rule ( const char* rule ) [inherited, pure virtual]
Description

Propose the specified rule in the current context

2.4. NV::Rules::IEvaluator Class Reference

[NvRules Tool lifetime-managed classes.]

The evaluator is used during rule setup to pass information about rule dependencies to the tool. For most cases, its Python wrapper functions can be used instead for convenience.

Public Member Functions

virtual void require_metric ( const char* metric ) =0
virtual void require_rule ( const char* rule ) =0

Member Functions

virtual void NV::​Rules::​IEvaluator::require_metric ( const char* metric ) [inherited, pure virtual]
Description

Define that the specified metric must have been collected in order for the calling rule to be applied.

virtual void NV::​Rules::​IEvaluator::require_rule ( const char* rule ) [inherited, pure virtual]
Description

Define that the specified rule must be available and ready to be applied in order for the calling rule to be applied itself.

2.5. NV::Rules::IFrontend Class Reference

[NvRules Tool lifetime-managed classes.]

The frontend is responsible for relaying messages and results to the caller via user interfaces, logs or output files.

Public Member Functions

virtual void load_chart_from_file ( const char* filename ) =0
virtual void message ( MsgType type, const char* str ) =0
virtual void message ( const char* str ) =0

Member Functions

virtual void NV::​Rules::​IFrontend::load_chart_from_file ( const char* filename ) [inherited, pure virtual]
Description

Load a ProfilerSection google protcol buffer chart from filename

virtual void NV::​Rules::​IFrontend::message ( MsgType type, const char* str ) [inherited, pure virtual]
Description

Issue a message str with a specific message type to the frontend

virtual void NV::​Rules::​IFrontend::message ( const char* str ) [inherited, pure virtual]
Description

Issue a message str to the frontend with the default MsgType

2.6. NV::Rules::IMetric Class Reference

[NvRules Python garbage-collected classes.]

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

Public Member Functions

virtual double  as_double ( size_t instance ) =0
Get a value from the metric list as double.
virtual double  as_double ( ) =0
Get the metric value as double.
virtual const char* as_string ( size_t instance ) =0
Get a value from the metric list as string.
virtual const char* as_string ( ) =0
Get the metric value as string.
virtual uint64_t as_uint64 ( size_t instance ) =0
Get a value from the metric list as 64bit integer.
virtual uint64_t as_uint64 ( ) =0
Get the metric value as 64bit integer.
virtual bool  has_value ( ValueKind value_kind ) =0
Check if the metric has a value of a specific kind.
virtual ValueKind kind ( size_t instance ) =0
Get the metric list entry value kind.
virtual ValueKind kind ( ) =0
Get the metric value kind.
virtual const char* name ( ) =0
Get the metric name.
virtual size_t num_instances ( ) =0
Get the number of values in the metric list.

Member Functions

virtual double NV::​Rules::​IMetric::as_double ( size_t instance ) [inherited, pure virtual]
Get a value from the metric list as double.
Description

Get a value instance from the metric list as double

virtual double NV::​Rules::​IMetric::as_double ( ) [inherited, pure virtual]
Get the metric value as double.
Description

Get the metric value as double

virtual const char* NV::​Rules::​IMetric::as_string ( size_t instance ) [inherited, pure virtual]
Get a value from the metric list as string.
Description

Get a value instance from the metric list as string

virtual const char* NV::​Rules::​IMetric::as_string ( ) [inherited, pure virtual]
Get the metric value as string.
Description

Get the metric value as string

virtual uint64_t NV::​Rules::​IMetric::as_uint64 ( size_t instance ) [inherited, pure virtual]
Get a value from the metric list as 64bit integer.
Description

Get a value instance from the metric list as 64bit integer

virtual uint64_t NV::​Rules::​IMetric::as_uint64 ( ) [inherited, pure virtual]
Get the metric value as 64bit integer.
Description

Get the metric value as 64bit integer

virtual bool NV::​Rules::​IMetric::has_value ( ValueKind value_kind ) [inherited, pure virtual]
Check if the metric has a value of a specific kind.
Description

Check if the metric has a value of a specific value_kind

virtual ValueKind NV::​Rules::​IMetric::kind ( size_t instance ) [inherited, pure virtual]
Get the metric list entry value kind.
Description

Get the metric list entry value kind

virtual ValueKind NV::​Rules::​IMetric::kind ( ) [inherited, pure virtual]
Get the metric value kind.
Description

Get the metric value kind

virtual const char* NV::​Rules::​IMetric::name ( ) [inherited, pure virtual]
Get the metric name.
Description

Get the metric name

virtual size_t NV::​Rules::​IMetric::num_instances ( ) [inherited, pure virtual]
Get the number of values in the metric list.
Description

Get the number of values in the metric list

2.7. NV::Rules::IRange Class Reference

[NvRules Python garbage-collected classes.]

Represents a serial, ordered stream of execution, such as a CUDA stream. It holds one or more actions that were logically executing in this range

Public Member Functions

virtual IActionaction_by_idx ( size_t idx ) =0
Get a single action by index.
virtual size_t num_actions ( ) =0
Get the number of actions.

Member Functions

virtual IAction* NV::​Rules::​IRange::action_by_idx ( size_t idx ) [inherited, pure virtual]
Get a single action by index.
Description

Get a single IAction by index idx.

virtual size_t NV::​Rules::​IRange::num_actions ( ) [inherited, pure virtual]
Get the number of actions.
Description

Get the number of available actions in this range

2.8. NV::Rules::ISourceInfo Class Reference

[NvRules Python garbage-collected classes.]

Represents the source correlation info for a specific function address within an action

Public Member Functions

virtual const char* file_name ( ) =0
Get the file name.
virtual uint32_t line ( ) =0
Get the file line.

Member Functions

virtual const char* NV::​Rules::​ISourceInfo::file_name ( ) [inherited, pure virtual]
Get the file name.
Description

Get the file name, as embedded in the correlation info

virtual uint32_t NV::​Rules::​ISourceInfo::line ( ) [inherited, pure virtual]
Get the file line.
Description

Get the line within file_name