QGIS API Documentation 3.40.0-Bratislava (b56115d8743)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Friends | List of all members
QgsRuntimeProfiler Class Reference

Provides a method of recording run time profiles of operations, allowing easy recording of their overall run time. More...

#include <qgsruntimeprofiler.h>

Inheritance diagram for QgsRuntimeProfiler:
Inheritance graph
[legend]

Public Member Functions

 QgsRuntimeProfiler ()
 Constructor to create a new runtime profiler.
 
 ~QgsRuntimeProfiler () override
 
QString asText (const QString &group=QString())
 Returns the model as a multi-line text string.
 
Q_DECL_DEPRECATED void beginGroup (const QString &name)
 Begin the group for the profiler.
 
QStringList childGroups (const QString &parent=QString(), const QString &group="startup") const
 Returns a list of all child groups with the specified parent.
 
void clear (const QString &group="startup")
 clear Clear all profile data.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
void end (const QString &group="startup")
 End the current profile event.
 
Q_DECL_DEPRECATED void endGroup ()
 End the current active group.
 
void groupAdded (const QString &group)
 Emitted when a new group has started being profiled.
 
bool groupIsActive (const QString &group) const
 Returns true if the specified group is currently being logged, i.e.
 
QSet< QString > groups () const
 Returns the set of known groups.
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &child) const override
 
double profileTime (const QString &name, const QString &group="startup") const
 Returns the profile time for the specified name.
 
void record (const QString &name, double time, const QString &group="startup", const QString &id=QString())
 Manually adds a profile event with the given name and total time (in seconds).
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
void start (const QString &name, const QString &group="startup", const QString &id=QString())
 Start a profile event with the given name.
 
double totalTime (const QString &group="startup")
 The current total time collected in the profiler.
 

Static Public Member Functions

static QString translateGroupName (const QString &group)
 Returns the translated name of a standard profile group.
 

Friends

class QgsApplication
 

Detailed Description

Provides a method of recording run time profiles of operations, allowing easy recording of their overall run time.

QgsRuntimeProfiler is not usually instantied manually, but rather accessed through QgsApplication::profiler().

This class is thread-safe only if accessed through QgsApplication::profiler(). If accessed in this way, operations can be profiled from non-main threads.

Definition at line 185 of file qgsruntimeprofiler.h.

Constructor & Destructor Documentation

◆ QgsRuntimeProfiler()

QgsRuntimeProfiler::QgsRuntimeProfiler ( )

Constructor to create a new runtime profiler.

Warning
QgsRuntimeProfiler is not usually instantied manually, but rather accessed through QgsApplication::profiler().

Definition at line 166 of file qgsruntimeprofiler.cpp.

◆ ~QgsRuntimeProfiler()

QgsRuntimeProfiler::~QgsRuntimeProfiler ( )
overridedefault

Member Function Documentation

◆ asText()

QString QgsRuntimeProfiler::asText ( const QString &  group = QString())

Returns the model as a multi-line text string.

Parameters
groupA group name to filter the model against.
Since
QGIS 3.34

Definition at line 658 of file qgsruntimeprofiler.cpp.

◆ beginGroup()

void QgsRuntimeProfiler::beginGroup ( const QString &  name)

Begin the group for the profiler.

Groups will append {GroupName}/ to the front of the profile tag set using start.

Parameters
nameThe name of the group.
Deprecated:
QGIS 3.40. Use start() instead.

Definition at line 188 of file qgsruntimeprofiler.cpp.

◆ childGroups()

QStringList QgsRuntimeProfiler::childGroups ( const QString &  parent = QString(),
const QString &  group = "startup" 
) const

Returns a list of all child groups with the specified parent.

Since
QGIS 3.14

Definition at line 198 of file qgsruntimeprofiler.cpp.

◆ clear()

void QgsRuntimeProfiler::clear ( const QString &  group = "startup")

clear Clear all profile data.

Definition at line 314 of file qgsruntimeprofiler.cpp.

◆ columnCount()

int QgsRuntimeProfiler::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 360 of file qgsruntimeprofiler.cpp.

◆ data()

QVariant QgsRuntimeProfiler::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

Definition at line 395 of file qgsruntimeprofiler.cpp.

◆ end()

void QgsRuntimeProfiler::end ( const QString &  group = "startup")

End the current profile event.

Definition at line 247 of file qgsruntimeprofiler.cpp.

◆ endGroup()

void QgsRuntimeProfiler::endGroup ( )

End the current active group.

Deprecated:
QGIS 3.40. Use end() instead.

Definition at line 193 of file qgsruntimeprofiler.cpp.

◆ groupAdded()

void QgsRuntimeProfiler::groupAdded ( const QString &  group)

Emitted when a new group has started being profiled.

◆ groupIsActive()

bool QgsRuntimeProfiler::groupIsActive ( const QString &  group) const

Returns true if the specified group is currently being logged, i.e.

it has a entry which has started and not yet stopped.

Since
QGIS 3.14

Definition at line 335 of file qgsruntimeprofiler.cpp.

◆ groups()

QSet< QString > QgsRuntimeProfiler::groups ( ) const
inline

Returns the set of known groups.

Definition at line 267 of file qgsruntimeprofiler.h.

◆ headerData()

QVariant QgsRuntimeProfiler::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Definition at line 426 of file qgsruntimeprofiler.cpp.

◆ index()

QModelIndex QgsRuntimeProfiler::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

Definition at line 366 of file qgsruntimeprofiler.cpp.

◆ parent()

QModelIndex QgsRuntimeProfiler::parent ( const QModelIndex &  child) const
override

Definition at line 379 of file qgsruntimeprofiler.cpp.

◆ profileTime()

double QgsRuntimeProfiler::profileTime ( const QString &  name,
const QString &  group = "startup" 
) const

Returns the profile time for the specified name.

Since
QGIS 3.14

Definition at line 305 of file qgsruntimeprofiler.cpp.

◆ record()

void QgsRuntimeProfiler::record ( const QString &  name,
double  time,
const QString &  group = "startup",
const QString &  id = QString() 
)

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.

Since
QGIS 3.34

Definition at line 273 of file qgsruntimeprofiler.cpp.

◆ rowCount()

int QgsRuntimeProfiler::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

Definition at line 351 of file qgsruntimeprofiler.cpp.

◆ start()

void QgsRuntimeProfiler::start ( const QString &  name,
const QString &  group = "startup",
const QString &  id = QString() 
)

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.

Definition at line 215 of file qgsruntimeprofiler.cpp.

◆ totalTime()

double QgsRuntimeProfiler::totalTime ( const QString &  group = "startup")

The current total time collected in the profiler.

Returns
The current total time collected in the profiler.

Definition at line 327 of file qgsruntimeprofiler.cpp.

◆ translateGroupName()

QString QgsRuntimeProfiler::translateGroupName ( const QString &  group)
static

Returns the translated name of a standard profile group.

Definition at line 340 of file qgsruntimeprofiler.cpp.

Friends And Related Symbol Documentation

◆ QgsApplication

friend class QgsApplication
friend

Definition at line 340 of file qgsruntimeprofiler.h.


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