Using the Python Profiler

About the Python Profiler

The Python Profiling viewport provides a simple interface for collecting and displaying Python profiling statistics of your Katana workspace.

This is to further help you debug which part of Katana’s user interface is causing slowdowns while an operation is being performed like changing a parameter for example.

Navigating and Operating the Python Profiler

To open up the Python Profiling viewport, first navigate to the Performance tab and then select Python Profiling from the dropdown menu located at the top of the pane.

Tip:  If a Performance tab does not exist in your Katana workspace, you can add it to your layout simply by navigating to the Tabs menu (Tabs > Performance tab) located in the menu bar at the top of your Katana workspace.

By default these are the standard controls displayed in the Python Profiling viewport.

Control

Function

To start and stop a profile.

Will clear the profile results listed in the table below once a profile has been completed.
Opens a new window to export profile results as a spreadsheet at a specified directory location.

Below these controls are where the profile results will be listed in a table. These will only display once you have completed a profile.

Each result will be displayed under each column and can be sorted by ascending or descending order. You can adjust this simply by clicking on the headers; indication arrows will be displayed on the right-hand side.

Indication arrow

Within the profile results table each column describes the following:

Header

Meaning

Indicates which functions were called during a profile.

Lists the number of calls made by each function.
Displays the cumulative time made by each result.
The quotient of cumulative time divided by the primitive calls (not listed).
Internal time for each result.
The quotient of internal time divided by the primitive calls (not listed).

Note:  The headers and their meanings are based on the sortKeys as specified by the official Python Documentation.

Performing a Profile

1.   To start a profile, click the Profile button and then proceed to perform some operations like changing a parameter.
2.   To end a profile and display the results, click the Profile button again.

Note:  To ensure the profile is running correctly, an indicator message located at the bottom left of the pane will change from Click Profile to start profiling to Profiling...

Viewing the Callers / Callees for each result

From the result table, you can access further details on each function.

Right-click on any result and select Get callers… or Get callees….

This will display a new window showing further information about the Callers and Callees contributing to the selected function call.

Note:  Caller results are operations that the function has called, while Callees results are operations that called to the function prior.