Starting and Ending a Profiling Session

A profiling session can be started and ended on Katana's main Runtime using the following Python calls:

from Katana import FnGeolib   #Get the Runtime runtime = FnGeolib.GetRegisteredRuntimeInstance()   #Start Profiling runtime.StartProfilingSession()   ...   #End Profiling runtime.EndProfilingSession()

This code can be called from a plug-in, a shelf script, or in the Python console in the standard interactive mode. It can also be invoked in --script and --shell modes. It is possible to start a profiling session on Katana startup and end it when Katana quits by using the --force-profile command-line option:

./katana --force-profile

Note:  This option causes all Geolib3 Runtime instances to start a profiling session upon initialization, meaning that reports are also created for additional instances, such as that used to cook Viewer proxies.

Note:  Since it is more contrived for you to start and end a profiling session, in --batch mode, Katana immediately starts a profiling session when launched with either the --profile or --force-profile options, and it ends the session once the render is finished. These options are, therefore, equivalent in --batch mode.