session

metrics

Description

The metrics action is used to display performance metrics for each subsequent action executed within the CAS session. When enabled, it provides a brief set of key metrics after an action completes, which is useful for performance monitoring and debugging.

session.metrics / on=TRUE | FALSE;
Settings
ParameterDescription
onSpecifies whether to display a brief set of action metrics after each action executes. When set to TRUE, metrics are enabled. When set to FALSE, they are disabled.
Data Preparation View data prep sheet
Prerequisite: Running an Action to Generate Metrics

The `session.metrics` action itself does not require a data table. However, to see its effect, you must run at least one other CAS action after enabling metrics. The following code runs the `serverStatus` action, which will generate metrics that can be observed.

Copied!
1PROC CAS;
2 BUILTINS.serverStatus;
3RUN;

Examples

This example demonstrates how to enable the display of performance metrics for all subsequent actions in the current session.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 SESSION.metrics / on=TRUE;
3RUN;
Result :
The action completes successfully. After this, every subsequent action will display a 'NOTE' in the log with performance metrics such as CPU time, data movement, and memory usage.

This example first enables metrics. It then runs the `listNodes` action. The log output for the `listNodes` action will be followed by a NOTE containing its performance metrics.

SAS® / CAS Code Code awaiting community validation
Copied!
1PROC CAS;
2 SESSION.metrics / on=TRUE;
3 BUILTINS.listNodes;
4RUN;
5 
6/* Disable metrics after use */
7PROC CAS;
8 SESSION.metrics / on=FALSE;
9RUN;
Result :
The log will first show the results of the `listNodes` action (a table of cluster nodes). Immediately following this output, a NOTE will appear detailing the performance metrics for the `listNodes` action, including execution time, CPU usage, and memory consumption.

FAQ

What is the purpose of the metrics action?
What parameter is used to control the display of metrics?
What are the possible values for the 'on' parameter and what is the default?
What is the CASL syntax for enabling action metrics?