Class: QgsScopedRuntimeProfile

class qgis.core.QgsScopedRuntimeProfile(name: str, group: str = '')

Bases: sip.wrapper

Constructor for QgsScopedRuntimeProfile.

Automatically registers the operation in the QgsApplication.profiler() instance and starts recording the run time of the operation.

QgsScopedRuntimeProfile(QgsScopedRuntimeProfile)

Scoped object for logging of the runtime for a single operation or group of operations.

This class automatically takes care of registering an operation in the QgsApplication.profiler() registry upon construction, and recording of the elapsed runtime upon destruction.

Python scripts should not use QgsScopedRuntimeProfile directly. Instead, use QgsRuntimeProfiler.profile() .. code-block:: python

with QgsRuntimeProfiler.profile(‘My operation’):

# do something

Methods

switchTask

Switches the current task managed by the scoped profile to a new task with the given name.

switchTask(self, name: str)

Switches the current task managed by the scoped profile to a new task with the given name. The current task will be finalised before switching.

This is useful for reusing an existing scoped runtime profiler with multi-step processes.

New in version 3.14.

Parameters

name (str) –