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

Public Member Functions

 QgsRuntimeProfilerNode (const QgsRuntimeProfilerNode &other)=delete
 QgsRuntimeProfilerNode cannot be copied.
 
 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
 QgsRuntimeProfilerNode cannot be copied.
 
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

◆ 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.

Id 

Internal node ID (since QGIS 3.34)

Definition at line 44 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 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 79 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 102 of file qgsruntimeprofiler.cpp.

◆ childAt()

QgsRuntimeProfilerNode * QgsRuntimeProfilerNode::childAt ( int  index)

Returns the child at the specified index.

Definition at line 114 of file qgsruntimeprofiler.cpp.

◆ childCount()

int QgsRuntimeProfilerNode::childCount ( ) const
inline

Returns the number of child nodes owned by this node.

Definition at line 89 of file qgsruntimeprofiler.h.

◆ clear()

void QgsRuntimeProfilerNode::clear ( )

Clears the node, removing all its children.

Definition at line 120 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 55 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 146 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 39 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 90 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 72 of file qgsruntimeprofiler.h.

◆ removeChildAt()

void QgsRuntimeProfilerNode::removeChildAt ( int  index)

Removes and deletes the child at the specified index.

Definition at line 125 of file qgsruntimeprofiler.cpp.

◆ setElapsed()

void QgsRuntimeProfilerNode::setElapsed ( double  time)

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

Definition at line 141 of file qgsruntimeprofiler.cpp.

◆ start()

void QgsRuntimeProfilerNode::start ( )

Starts the node timer.

See also
stop()

Definition at line 131 of file qgsruntimeprofiler.cpp.

◆ stop()

void QgsRuntimeProfilerNode::stop ( )

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

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


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