QGIS API Documentation  3.24.2-Tisler (13c1a02865)
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  Roles { Name = Qt::UserRole + 1 , Group , Elapsed , ParentElapsed }
 Custom node data roles. More...
 

Public Member Functions

 QgsRuntimeProfilerNode (const QgsRuntimeProfilerNode &other)=delete
 QgsRuntimeProfilerNode cannot be copied. More...
 
 QgsRuntimeProfilerNode (const QString &group, const QString &name)
 Constructor for QgsRuntimeProfilerNode, with the specified group and name. More...
 
 ~QgsRuntimeProfilerNode ()
 
void addChild (std::unique_ptr< QgsRuntimeProfilerNode > child)
 Adds a child node to this node. More...
 
QgsRuntimeProfilerNodechild (const QString &group, const QString &name)
 Finds the child with matching group and name. More...
 
QgsRuntimeProfilerNodechildAt (int index)
 Returns the child at the specified index. More...
 
int childCount () const
 Returns the number of child nodes owned by this node. More...
 
void clear ()
 Clears the node, removing all its children. More...
 
QVariant data (int role=Qt::DisplayRole) const
 Returns the node's data for the specified model role. More...
 
double elapsed () const
 Returns the node's elapsed time, in seconds. More...
 
QStringList fullParentPath () const
 Returns the full path to the node's parent. More...
 
int indexOf (QgsRuntimeProfilerNode *child) const
 Returns the index of the specified child node. More...
 
QgsRuntimeProfilerNodeoperator= (const QgsRuntimeProfilerNode &other)=delete
 QgsRuntimeProfilerNode cannot be copied. More...
 
QgsRuntimeProfilerNodeparent ()
 Returns the node's parent node. More...
 
void removeChildAt (int index)
 Removes and deletes the child at the specified index. More...
 
void setElapsed (double time)
 Manually sets the node's elapsed time, in seconds. More...
 
void start ()
 Starts the node timer. More...
 
void stop ()
 Stops the node's timer, recording the elapsed time automatically. More...
 
double totalElapsedTimeForChildren (const QString &group) const
 Returns the total elapsed time in seconds for all children of this node with matching group. More...
 

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

◆ Roles

Custom node data roles.

Enumerator
Name 

Profile item name.

Group 

Node group.

Elapsed 

Node elapsed time.

ParentElapsed 

Total elapsed time for node's parent.

Definition at line 44 of file qgsruntimeprofiler.h.

Constructor & Destructor Documentation

◆ QgsRuntimeProfilerNode() [1/2]

QgsRuntimeProfilerNode::QgsRuntimeProfilerNode ( const QString &  group,
const QString &  name 
)

Constructor for QgsRuntimeProfilerNode, with the specified group and name.

Definition at line 29 of file qgsruntimeprofiler.cpp.

◆ QgsRuntimeProfilerNode() [2/2]

QgsRuntimeProfilerNode::QgsRuntimeProfilerNode ( const QgsRuntimeProfilerNode other)
delete

QgsRuntimeProfilerNode cannot be copied.

◆ ~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 72 of file qgsruntimeprofiler.cpp.

◆ child()

QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::child ( const QString &  group,
const QString &  name 
)

Finds the child with matching group and name.

Returns nullptr if a matching child was not found.

Definition at line 95 of file qgsruntimeprofiler.cpp.

◆ childAt()

QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::childAt ( int  index)

Returns the child at the specified index.

Definition at line 105 of file qgsruntimeprofiler.cpp.

◆ childCount()

int QgsRuntimeProfilerNode::childCount ( ) const
inline

Returns the number of child nodes owned by this node.

Definition at line 84 of file qgsruntimeprofiler.h.

◆ clear()

void QgsRuntimeProfilerNode::clear ( )

Clears the node, removing all its children.

Definition at line 111 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 51 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 137 of file qgsruntimeprofiler.cpp.

◆ fullParentPath()

QStringList QgsRuntimeProfilerNode::fullParentPath ( ) const

Returns the full path to the node's parent.

Definition at line 38 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 83 of file qgsruntimeprofiler.cpp.

◆ operator=()

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

QgsRuntimeProfilerNode cannot be copied.

◆ parent()

QgsRuntimeProfilerNode* QgsRuntimeProfilerNode::parent ( )
inline

Returns the node's parent node.

If parent is nullptr, the node is a root node

Definition at line 69 of file qgsruntimeprofiler.h.

◆ removeChildAt()

void QgsRuntimeProfilerNode::removeChildAt ( int  index)

Removes and deletes the child at the specified index.

Definition at line 116 of file qgsruntimeprofiler.cpp.

◆ setElapsed()

void QgsRuntimeProfilerNode::setElapsed ( double  time)

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

Definition at line 132 of file qgsruntimeprofiler.cpp.

◆ start()

void QgsRuntimeProfilerNode::start ( )

Starts the node timer.

See also
stop()

Definition at line 122 of file qgsruntimeprofiler.cpp.

◆ stop()

void QgsRuntimeProfilerNode::stop ( )

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

Definition at line 127 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 142 of file qgsruntimeprofiler.cpp.


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