---
title: "Stats in Katana"
canonical: "https://rmanwiki-27.pixar.com/space/RFK27/637632529/Stats%20in%20Katana"
format: markdown
---
RenderMan diagnostics are available in Katana as live stats and offline JSON reports. Access to more advanced configuration is also available with the use of an environment variable or through a specialized OpScript.

## <span style="color: #4c9aff">Live Stats</span>

The PrmanLiveStats Tab displays a live overview of metric data from an active Katana render. 

![kat_livestats_27.png](media://d5bbd62c-a43c-4399-a647-041c5949205f)


It displays several key metrics in real time, including process memory, elapsed wall clock time, and render progress. The window will automatically connect and disconnect as renders start and stop. When a render completes or is canceled, its data remains in the live stats view until the next render starts or a new scene loads.

See [https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233487](https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233487) for detailed information about the contents of this window.

## <span style="color: #4c9aff">JSON Report</span>

To generate an end-of-render diagnostic report, set the PrmanGlobalStatements **JSON Report Filename **attribute to the desired output filename. (prmanGlobalStatements.options.statistics.jsonFilename). 

![kat_pgs_json.png](media://6427ac74-db37-4b74-8059-1abf9bc55840)

See the [https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233529](https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233529)documentation for detailed information on the configuration and interpretation of this report.

## <span style="color: #4c9aff">Custom Configuration</span>

For more control over diagnostic output, RfK can be directed to use a [configuration file](https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233443) using the environment variable [$RMAN_STATS_CONFIG_PATH](https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233443/Configuration#Search-Path). Additionally, RfK supports customization of the configuration file search path and/or the configuration file name via specialized attributes:

`prmanGlobalStatements.stats.configPath` (default: `“$RMANTREE/etc"`)

`prmanGlobalStatements.stats.configFile` (default: `"stats.ini"`)

If set, these will take precedence over other options. The “stats” attributes are not exposed in PrmanGlobalStatements; they must be set via AttributeSet or OpScript. Below is an OpScript that exposes these two attributes as user args with defaults as listed above. Copy and paste into your Katana scene and modify the user attributes configPath and configFile name as needed.

RfK will search for a configuration file with the following precedence:

1. `The prmanGlobalStatements.stats` options take precedence over all other options (see OpScript below).
2. `$RMAN_STATS_CONFIG_PATH/stats.ini` if the environment variable is set.
3. `$RMANTREE/etc/stats.ini`

<details>
<summary>PrmanStatsConfiguration OpScript</summary>

```xml
<katana release="8.0v4" version="7.0.5.000001">
  <node name="__SAVE_exportedNodes" type="Group">
    <node baseType="OpScript" edited="true" name="PrmanStatsConfiguration" ns_basicDisplay="1" ns_colorb="0.4" ns_colorg="0.1" ns_colorr="0.14" ns_errorGlow="0.0" ns_fromContext="legacy" selected="true" type="OpScript" x="-64.5" y="-101.473">
      <port name="i0" source="MaterialAssign.out" type="in"/>
      <port name="out" type="out"/>
      <group_parameter name="PrmanStatsConfiguration">
        <string_parameter name="CEL" value="((/root))"/>
        <string_parameter name="location" value="/root/world/location"/>
        <group_parameter name="script">
          <string_parameter name="lua" value=" -- Default: &apos;stats.ini&apos;&#0010;local configFile = Interface.GetOpArg(&apos;user.configFile&apos;):getValue()&#0010;Interface.SetAttr(&apos;prmanGlobalStatements.stats.configFile&apos;, StringAttribute(configFile))&#0010;&#0010;-- Default: &apos;.:${RMANTREE}/etc&apos;&#0010;-- This will override RMAN_STATS_CONFIG_PATH environment variable, if set.&#0010;local configPath = Interface.GetOpArg(&apos;user.configPath&apos;):getValue()&#0010;Interface.SetAttr(&apos;prmanGlobalStatements.stats.configPath&apos;, StringAttribute(configPath))&#0010;"/>
        </group_parameter>
        <string_parameter name="executionMode" value="immediate"/>
        <string_parameter name="applyWhere" value="at locations matching CEL"/>
        <string_parameter name="applyWhen" value="during op resolve"/>
        <string_parameter name="modifierNameMode" value="node name"/>
        <string_parameter name="modifierName" value="modifier"/>
        <string_parameter name="resolveIds" value=""/>
        <number_parameter name="recursiveEnable" value="0"/>
        <string_parameter name="disableAt" value=""/>
        <string_parameter name="inputBehavior" value="by index"/>
        <number_parameter name="multisampleUserOpArgs" value="0"/>
        <group_parameter hints="{}" name="user">
          <string_parameter hints="{&apos;widget&apos;: &apos;fileInput&apos;, &apos;help&apos;: &apos;Sets the file name for the configuration of RenderMan statistics. This file name will be appended to the configPath setting to build the full path to the configuration file. Configuration files are not merged so the path built by these settings will override the RMAN_STATS_CONFIG_PATH search path.&apos;}" name="configFile" value="stats.ini"/>
          <string_parameter expression="getenv(&apos;RMANTREE&apos;, &apos;&apos;)+&apos;/etc&apos;" hints="{&apos;help&apos;: &apos;Sets the search path for the configuration of RenderMan statistics. This path will be will be combined with the configFile setting to build the full path to the configuration file. Configuration files are not merged so the path built by these settings will override the RMAN_STATS_CONFIG_PATH search path.&apos;}" name="configPath"/>
        </group_parameter>
      </group_parameter>
    </node>
  </node>
</katana>
```
</details>

## <span style="color: #4c9aff">Troubleshooting</span>

Normally, the stats system does most of its work quietly behind the scenes. However, for those situations when things aren't working as expected, there are built-in mechanisms to get diagnostics on the diagnostics system.

First, understand that you cannot disable stats *collection*. This functionality is embedded in the renderer and remains “always on”. However, you can control how the diagnostic data is *delivered *and* presented*.

The stats.ini file used to configure the stats system includes flags to increase verbosity during config file loading and subsequent processing. If you are not explicitly using a custom stats.ini file, the default configuration will come from $RMANTREE/etc/stats.ini.

In your config file, set the stats debug *logLevel* to 5:

```
# Stats processing log level.
# Range is 0 (none) to 5 (debug output). Default is 3 (warnings)
logLevel 5
```

You should see an uptick of `RZ0000` output to the Render Log, which will help you verify it's picking up the stats.ini file you expect. It will also tell you whether or not the WebSocket stats server is enabled for live stats.

```
RZ0000 {INFO}   : SessionConfig - Loaded stats config from file: '/path/to/stats.ini'.
RZ9000 rfk_statsserver_<renderboot_PID>
RZ0000 {INFO} : Session - Created stats session: 'Stats Session Name'.
RZ0000 {DEBUG} : Session - WebSocket stats server not enabled
RZ0000 {DEBUG} : Session - Loading listeners​
```

If you do not see these log messages after turning up the log level verbosity, you are likely picking up a different stats.ini configuration file. Check for an RMAN_STATS_CONFIG_PATH environment variable, or path/filename values from the `prmanGlobalStatements.stats` attributes.

Please refer to the general [https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233691](https://renderman.atlassian.net/wiki/spaces/REN27/pages/542233691) document for further help diagnosing stats system issues.