1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
|
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsruntimeprofiler.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
class QgsRuntimeProfiler : QAbstractItemModel
{
%Docstring(signature="appended")
Provides a method of recording run time profiles of operations, allowing
easy recording of their overall run time.
:py:class:`QgsRuntimeProfiler` is not usually instantied manually, but
rather accessed through :py:func:`QgsApplication.profiler()`.
This class is thread-safe only if accessed through
:py:func:`QgsApplication.profiler()`. If accessed in this way,
operations can be profiled from non-main threads.
%End
%TypeHeaderCode
#include "qgsruntimeprofiler.h"
%End
public:
QgsRuntimeProfiler();
%Docstring
Constructor to create a new runtime profiler.
.. warning::
QgsRuntimeProfiler is not usually instantied manually, but rather accessed
through :py:func:`QgsApplication.profiler()`.
%End
~QgsRuntimeProfiler();
void beginGroup( const QString &name ) /Deprecated/;
%Docstring
Begin the group for the profiler. Groups will append {GroupName}/ to the
front of the profile tag set using start.
:param name: The name of the group.
.. deprecated:: 3.40
Use :py:func:`~QgsRuntimeProfiler.start` instead.
%End
void endGroup() /Deprecated/;
%Docstring
End the current active group.
.. deprecated:: 3.40
Use :py:func:`~QgsRuntimeProfiler.end` instead.
%End
QStringList childGroups( const QString &parent = QString(), const QString &group = "startup" ) const;
%Docstring
Returns a list of all child groups with the specified ``parent``.
.. versionadded:: 3.14
%End
void start( const QString &name, const QString &group = "startup", const QString &id = QString() );
%Docstring
Start a profile event with the given name. The ``name`` of the profile
event. Will have the name of the active ``group`` appended after ending.
Since QGIS 3.34, the optional ``id`` argument can be used to provide a
unique ID to disambiguate nodes with the same ``name``.
%End
void end( const QString &group = "startup" );
%Docstring
End the current profile event.
%End
void record( const QString &name, double time, const QString &group = "startup", const QString &id = QString() );
%Docstring
Manually adds a profile event with the given name and total ``time`` (in
seconds).
The optional ``id`` argument can be used to provider a unique ID to
disambiguate nodes with the same ``name``.
.. versionadded:: 3.34
%End
double profileTime( const QString &name, const QString &group = "startup" ) const;
%Docstring
Returns the profile time for the specified ``name``.
.. versionadded:: 3.14
%End
void clear( const QString &group = "startup" );
%Docstring
clear Clear all profile data.
%End
double totalTime( const QString &group = "startup" );
%Docstring
The current total time collected in the profiler.
:return: The current total time collected in the profiler.
%End
QSet< QString > groups() const;
%Docstring
Returns the set of known groups.
%End
bool groupIsActive( const QString &group ) const;
%Docstring
Returns ``True`` if the specified ``group`` is currently being logged,
i.e. it has a entry which has started and not yet stopped.
.. versionadded:: 3.14
%End
static QString translateGroupName( const QString &group );
%Docstring
Returns the translated name of a standard profile ``group``.
%End
virtual int rowCount( const QModelIndex &parent = QModelIndex() ) const;
virtual int columnCount( const QModelIndex &parent = QModelIndex() ) const;
virtual QModelIndex index( int row, int column, const QModelIndex &parent = QModelIndex() ) const;
virtual QModelIndex parent( const QModelIndex &child ) const;
virtual QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const;
virtual QVariant headerData( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
QString asText( const QString &group = QString() );
%Docstring
Returns the model as a multi-line text string.
:param group: A group name to filter the model against.
.. versionadded:: 3.34
%End
void groupAdded( const QString &group );
%Docstring
Emitted when a new group has started being profiled.
%End
};
class QgsScopedRuntimeProfile
{
%Docstring(signature="appended")
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
:py:func:`QgsApplication.profiler()` registry upon construction, and
recording of the elapsed runtime upon destruction.
Python scripts should not use :py:class:`QgsScopedRuntimeProfile`
directly. Instead, use :py:func:`QgsRuntimeProfiler.profile()`
.. code-block:: python
with QgsRuntimeProfiler.profile('My operation'):
# do something
.. versionadded:: 3.14
%End
%TypeHeaderCode
#include "qgsruntimeprofiler.h"
%End
public:
QgsScopedRuntimeProfile( const QString &name, const QString &group = "startup", const QString &id = QString() );
%Docstring
Constructor for QgsScopedRuntimeProfile.
Automatically registers the operation in the
:py:func:`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``.
%End
~QgsScopedRuntimeProfile();
void switchTask( const QString &name );
%Docstring
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.
.. versionadded:: 3.14
%End
};
/************************************************************************
* This file has been generated automatically from *
* *
* src/core/qgsruntimeprofiler.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.py again *
************************************************************************/
|