# stats¶

Outputs statistics about a Gaffer script, including the version of Gaffer that created it, the values of all setting and variables and the types of node in use. May also be used to perform performance analysis of image and scene processing nodes within the script, using a performance monitor to generate advanced statistics.

To output basic information about a script :

gaffer stats fileName.gfr


To run a scene processing node using the performance monitor :

gaffer stats fileName.gfr -scene NameOfNode -performanceMonitor


To run an image processing node using the performance monitor :

gaffer stats fileName.gfr -image NameOfNode -performanceMonitor


## -help¶

Prints names and descriptions of each parameter rather than running the application.

The maximum number of threads used for computation. The default value of zero causes the number of threads to be chosen automatically based on the available hardware.

## -profileFileName¶

If this is specified, then the application is run using the cProfile profiling module, and the results saved to the file for later examination.

## -script¶

The script to examine.

A python script to run after loading script. This can be used to modify the node graph before stats are gathered. The root ScriptNode is accessible via a variable named root.

## -outputFile¶

Output the results to this file on disk rather than stdout

## -frames¶

The frames to evaluate statistics for. The default value uses the current frame as stored in the script.

## -nodeSummary¶

Turns on a summary of nodes in the script.

## -scene¶

The name of a SceneNode or ScenePlug to examine. A Render node or TaskPlug on a Render node may also be passed, to perform profiling of the render output process without performing the actual image generation.

## -sets¶

The names of scene sets to be examined.

## -image¶

The name of an ImageNode or ImagePlug to examine.

## -preCache¶

Prepopulates the cache by evaluating the scene or image once prior to measuring the second evaluation.

## -performanceMonitor¶

Turns on a performance monitor to provide additional statistics about the operation of the node graph.

## -maxLinesPerMetric¶

The maximum number of plugs to list for each metric captured by the performance monitor.

## -contextMonitor¶

Turns on a Context monitor to provide additional statistics about the operation of the node graph.

## -contextMonitorRoot¶

The name of a node or plug to provide a root for the Context monitor. Statistics will only be captured for this root downwards.

## -annotatedScript¶

Filename used to save a copy of the script containing annotations from the performance and Context monitors.

## -vtune¶

Enables VTune instrumentation. When enabled, the VTune ‘Tasks & Frames’ view will be broken down by node type.

## -contextSanitiser¶

Checks for Contexts containing “leaked” variables that may affect performance. Any problems are reported as warnings to stderr.

## -canceller¶

Adds an IECore.Canceller to the Context used for computations. This can be used to measure any overhead generated by nodes checking for cancellation.

## -cacheMemoryLimit¶

The memory limit for the ValuePlug cache, measured in Mb. If this is not specified, the default limit will be used, or a limit specified by an application startup file.

## -hashCacheSizeLimit¶

The size limit for the per-thread hash cache. If this is not specified, the default limit will be used, or a limit specified by an application startup file.