QGIS API Documentation 3.41.0-Master (fda2aa46e9a)
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QgsRuntimeProfilerNode Class Reference

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.
 
QgsRuntimeProfilerNodechild (const QString &group, const QString &name, const QString &id=QString())
 Finds the child with matching group, name and id (since QGIS 3.34).
 
QgsRuntimeProfilerNodechildAt (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.
 
QgsRuntimeProfilerNodeoperator= (const QgsRuntimeProfilerNode &other)=delete
 
QgsRuntimeProfilerNodeparent ()
 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.
 

Detailed Description

A node representing an entry in a QgsRuntimeProfiler.

Since
QGIS 3.16

Definition at line 39 of file qgsruntimeprofiler.h.

Member Enumeration Documentation

◆ CustomRole

enum class QgsRuntimeProfilerNode::CustomRole : int
strong

Custom node data roles.

Note
Prior to QGIS 3.36 this was available as QgsRuntimeProfilerNode::Roles
Since
QGIS 3.36
Enumerator
Name 

Profile item name.

Group 

Node group.

Elapsed 

Node elapsed time.

ParentElapsed 

Total elapsed time for node's parent.

Id 

Internal node ID.

Since
QGIS 3.34

Definition at line 51 of file qgsruntimeprofiler.h.

Constructor & Destructor Documentation

◆ QgsRuntimeProfilerNode() [1/2]

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.

◆ QgsRuntimeProfilerNode() [2/2]

QgsRuntimeProfilerNode::QgsRuntimeProfilerNode ( const QgsRuntimeProfilerNode other)
delete

◆ ~QgsRuntimeProfilerNode()

QgsRuntimeProfilerNode::~QgsRuntimeProfilerNode ( )
default

Member Function Documentation

◆ addChild()

void QgsRuntimeProfilerNode::addChild ( std::unique_ptr< QgsRuntimeProfilerNode child)

Adds a child node to this node.

Definition at line 80 of file qgsruntimeprofiler.cpp.

◆ child()

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.

◆ childAt()

QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::childAt ( int  index)

Returns the child at the specified index.

Definition at line 115 of file qgsruntimeprofiler.cpp.

◆ childCount()

int QgsRuntimeProfilerNode::childCount ( ) const
inline

Returns the number of child nodes owned by this node.

Definition at line 95 of file qgsruntimeprofiler.h.

◆ clear()

void QgsRuntimeProfilerNode::clear ( )

Clears the node, removing all its children.

Definition at line 121 of file qgsruntimeprofiler.cpp.

◆ data()

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.

◆ elapsed()

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.

◆ fullParentPath()

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.

◆ indexOf()

int QgsRuntimeProfilerNode::indexOf ( QgsRuntimeProfilerNode child) const

Returns the index of the specified child node.

Warning
child must be a valid child of this node.

Definition at line 91 of file qgsruntimeprofiler.cpp.

◆ operator=()

QgsRuntimeProfilerNode & QgsRuntimeProfilerNode::operator= ( const QgsRuntimeProfilerNode other)
delete

◆ parent()

QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::parent ( )
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.

◆ removeChildAt()

void QgsRuntimeProfilerNode::removeChildAt ( int  index)

Removes and deletes the child at the specified index.

Definition at line 126 of file qgsruntimeprofiler.cpp.

◆ setElapsed()

void QgsRuntimeProfilerNode::setElapsed ( double  time)

Manually sets the node's elapsed time, in seconds.

Definition at line 142 of file qgsruntimeprofiler.cpp.

◆ start()

void QgsRuntimeProfilerNode::start ( )

Starts the node timer.

See also
stop()

Definition at line 132 of file qgsruntimeprofiler.cpp.

◆ stop()

void QgsRuntimeProfilerNode::stop ( )

Stops the node's timer, recording the elapsed time automatically.

Definition at line 137 of file qgsruntimeprofiler.cpp.

◆ totalElapsedTimeForChildren()

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.


The documentation for this class was generated from the following files: