QGIS API Documentation 3.41.0-Master (45a0abf3bec)
|
Scoped object for logging of the runtime for a single operation or group of operations. More...
#include <qgsruntimeprofiler.h>
Public Member Functions | |
QgsScopedRuntimeProfile (const QString &name, const QString &group="startup", const QString &id=QString()) | |
Constructor for QgsScopedRuntimeProfile. | |
~QgsScopedRuntimeProfile () | |
Records the final runtime of the operation in the profiler instance. | |
void | switchTask (const QString &name) |
Switches the current task managed by the scoped profile to a new task with the given name. | |
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()
Definition at line 360 of file qgsruntimeprofiler.h.
QgsScopedRuntimeProfile::QgsScopedRuntimeProfile | ( | const QString & | name, |
const QString & | group = "startup" , |
||
const QString & | id = QString() |
||
) |
Constructor for QgsScopedRuntimeProfile.
Automatically registers the operation in the QgsApplication::profiler() instance and starts recording the run time of the operation.
Since QGIS 3.34, the optional id argument can be used to provide a unique ID to disambiguate nodes with the same name.
Definition at line 679 of file qgsruntimeprofiler.cpp.
QgsScopedRuntimeProfile::~QgsScopedRuntimeProfile | ( | ) |
Records the final runtime of the operation in the profiler instance.
Definition at line 685 of file qgsruntimeprofiler.cpp.
void QgsScopedRuntimeProfile::switchTask | ( | const QString & | name | ) |
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.
Definition at line 690 of file qgsruntimeprofiler.cpp.