15 #ifndef QGSRUNTIMEPROFILER_H
16 #define QGSRUNTIMEPROFILER_H
19 #include <QElapsedTimer>
24 #include <QAbstractItemModel>
28 #include "qgis_core.h"
53 Name = Qt::UserRole + 1,
87 QStringList fullParentPath()
const;
92 QVariant data(
int role = Qt::DisplayRole )
const;
102 void addChild( std::unique_ptr< QgsRuntimeProfilerNode > child );
115 QgsRuntimeProfilerNode *child(
const QString &group,
const QString &name,
const QString &
id = QString() );
130 void removeChildAt(
int index );
146 void setElapsed(
double time );
153 double elapsed()
const;
159 double totalElapsedTimeForChildren(
const QString &group )
const;
162 std::deque< std::unique_ptr< QgsRuntimeProfilerNode > > mChildren;
164 QElapsedTimer mProfileTime;
209 Q_DECL_DEPRECATED
void beginGroup(
const QString &name )
SIP_DEPRECATED;
222 QStringList childGroups( const QString &parent = QString(), const QString &group = "startup" ) const;
232 void start( const QString &name, const QString &group = "startup", const QString &
id = QString() );
237 void end( const QString &group = "startup" );
247 void record( const QString &name,
double time, const QString &group = "startup", const QString &
id = QString() );
253 double profileTime( const QString &name, const QString &group = "startup" ) const;
258 void clear( const QString &group = "startup" );
264 double totalTime( const QString &group = "startup" );
269 QSet< QString > groups()
const {
return mGroups; }
277 bool groupIsActive(
const QString &group )
const;
282 static QString translateGroupName(
const QString &group );
286 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
287 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
288 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
289 QModelIndex parent(
const QModelIndex &child )
const override;
290 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
291 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
298 QString asText(
const QString &group = QString() );
304 void started(
const QString &group,
const QStringList &path,
const QString &name,
const QString &
id );
305 void ended(
const QString &group,
const QStringList &path,
const QString &name,
const QString &
id,
double elapsed );
316 void otherProfilerStarted(
const QString &group,
const QStringList &path,
const QString &name,
const QString &
id );
317 void otherProfilerEnded(
const QString &group,
const QStringList &path,
const QString &name,
const QString &
id,
double elapsed );
323 bool mInitialized =
false;
324 void setupConnections();
330 void extractModelAsText( QStringList &lines,
const QString &group,
const QModelIndex &parent = QModelIndex(),
int level = 0 );
337 QMap< QString, QStack< QgsRuntimeProfilerNode * > > mCurrentStack;
338 std::unique_ptr< QgsRuntimeProfilerNode > mRootNode;
340 QSet< QString > mGroups;
375 QgsScopedRuntimeProfile(
const QString &name,
const QString &group =
"startup",
const QString &
id = QString() );
390 void switchTask(
const QString &name );
Extends QApplication to provide access to QGIS specific resources such as theme paths,...
A node representing an entry in a QgsRuntimeProfiler.
QgsRuntimeProfilerNode * parent()
Returns the node's parent node.
QgsRuntimeProfilerNode & operator=(const QgsRuntimeProfilerNode &other)=delete
QgsRuntimeProfilerNode cannot be copied.
QgsRuntimeProfilerNode(const QgsRuntimeProfilerNode &other)=delete
QgsRuntimeProfilerNode cannot be copied.
CustomRole
Custom node data roles.
int childCount() const
Returns the number of child nodes owned by this node.
~QgsRuntimeProfilerNode()
Provides a method of recording run time profiles of operations, allowing easy recording of their over...
void groupAdded(const QString &group)
Emitted when a new group has started being profiled.
~QgsRuntimeProfiler() override
Scoped object for logging of the runtime for a single operation or group of operations.
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)