QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
|
A node representing an entry in a QgsRuntimeProfiler. More...
#include <qgsruntimeprofiler.h>
Public Types | |
enum class | CustomRole : int { Name = Qt::UserRole + 1 , Group , Elapsed , ParentElapsed , Id } |
Custom node data roles. More... | |
Public Member Functions | |
QgsRuntimeProfilerNode (const QgsRuntimeProfilerNode &other)=delete | |
QgsRuntimeProfilerNode (const QString &group, const QString &name, const QString &id=QString()) | |
Constructor for QgsRuntimeProfilerNode, with the specified group and name. | |
~QgsRuntimeProfilerNode () | |
void | addChild (std::unique_ptr< QgsRuntimeProfilerNode > child) |
Adds a child node to this node. | |
QgsRuntimeProfilerNode * | child (const QString &group, const QString &name, const QString &id=QString()) |
Finds the child with matching group, name and id (since QGIS 3.34). | |
QgsRuntimeProfilerNode * | childAt (int index) |
Returns the child at the specified index. | |
int | childCount () const |
Returns the number of child nodes owned by this node. | |
void | clear () |
Clears the node, removing all its children. | |
QVariant | data (int role=Qt::DisplayRole) const |
Returns the node's data for the specified model role. | |
double | elapsed () const |
Returns the node's elapsed time, in seconds. | |
QStringList | fullParentPath () const |
Returns the full path to the node's parent. | |
int | indexOf (QgsRuntimeProfilerNode *child) const |
Returns the index of the specified child node. | |
QgsRuntimeProfilerNode & | operator= (const QgsRuntimeProfilerNode &other)=delete |
QgsRuntimeProfilerNode * | parent () |
Returns the node's parent node. | |
void | removeChildAt (int index) |
Removes and deletes the child at the specified index. | |
void | setElapsed (double time) |
Manually sets the node's elapsed time, in seconds. | |
void | start () |
Starts the node timer. | |
void | stop () |
Stops the node's timer, recording the elapsed time automatically. | |
double | totalElapsedTimeForChildren (const QString &group) const |
Returns the total elapsed time in seconds for all children of this node with matching group. | |
A node representing an entry in a QgsRuntimeProfiler.
Definition at line 39 of file qgsruntimeprofiler.h.
|
strong |
Custom node data roles.
Enumerator | |
---|---|
Name | Profile item name. |
Group | Node group. |
Elapsed | Node elapsed time. |
ParentElapsed | Total elapsed time for node's parent. |
Id | Internal node ID.
|
Definition at line 51 of file qgsruntimeprofiler.h.
QgsRuntimeProfilerNode::QgsRuntimeProfilerNode | ( | const QString & | group, |
const QString & | name, | ||
const QString & | id = QString() |
||
) |
Constructor for QgsRuntimeProfilerNode, with the specified group and name.
Since QGIS 3.34 an internal id can be specified to disambiguate entries with duplicate names.
Definition at line 30 of file qgsruntimeprofiler.cpp.
|
delete |
|
default |
void QgsRuntimeProfilerNode::addChild | ( | std::unique_ptr< QgsRuntimeProfilerNode > | child | ) |
Adds a child node to this node.
Definition at line 80 of file qgsruntimeprofiler.cpp.
QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::child | ( | const QString & | group, |
const QString & | name, | ||
const QString & | id = QString() |
||
) |
Finds the child with matching group, name and id (since QGIS 3.34).
Returns nullptr
if a matching child was not found.
Definition at line 103 of file qgsruntimeprofiler.cpp.
QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::childAt | ( | int | index | ) |
Returns the child at the specified index.
Definition at line 115 of file qgsruntimeprofiler.cpp.
|
inline |
Returns the number of child nodes owned by this node.
Definition at line 95 of file qgsruntimeprofiler.h.
void QgsRuntimeProfilerNode::clear | ( | ) |
Clears the node, removing all its children.
Definition at line 121 of file qgsruntimeprofiler.cpp.
QVariant QgsRuntimeProfilerNode::data | ( | int | role = Qt::DisplayRole | ) | const |
Returns the node's data for the specified model role.
Definition at line 56 of file qgsruntimeprofiler.cpp.
double QgsRuntimeProfilerNode::elapsed | ( | ) | const |
Returns the node's elapsed time, in seconds.
If the node is still running then 0 will be returned.
Definition at line 147 of file qgsruntimeprofiler.cpp.
QStringList QgsRuntimeProfilerNode::fullParentPath | ( | ) | const |
Returns the full path to the node's parent.
This will contain node IDs if set, otherwise node names.
Definition at line 40 of file qgsruntimeprofiler.cpp.
int QgsRuntimeProfilerNode::indexOf | ( | QgsRuntimeProfilerNode * | child | ) | const |
Returns the index of the specified child node.
Definition at line 91 of file qgsruntimeprofiler.cpp.
|
delete |
|
inline |
Returns the node's parent node.
If parent is nullptr
, the node is a root node
Definition at line 78 of file qgsruntimeprofiler.h.
void QgsRuntimeProfilerNode::removeChildAt | ( | int | index | ) |
Removes and deletes the child at the specified index.
Definition at line 126 of file qgsruntimeprofiler.cpp.
void QgsRuntimeProfilerNode::setElapsed | ( | double | time | ) |
Manually sets the node's elapsed time, in seconds.
Definition at line 142 of file qgsruntimeprofiler.cpp.
void QgsRuntimeProfilerNode::start | ( | ) |
void QgsRuntimeProfilerNode::stop | ( | ) |
Stops the node's timer, recording the elapsed time automatically.
Definition at line 137 of file qgsruntimeprofiler.cpp.
double QgsRuntimeProfilerNode::totalElapsedTimeForChildren | ( | const QString & | group | ) | const |
Returns the total elapsed time in seconds for all children of this node with matching group.
Definition at line 152 of file qgsruntimeprofiler.cpp.