15 #ifndef QGSRUNTIMEPROFILER_H
16 #define QGSRUNTIMEPROFILER_H
19 #include <QElapsedTimer>
24 #include <QAbstractItemModel>
28 #include "qgis_core.h"
46 Name = Qt::UserRole + 1,
74 QStringList fullParentPath()
const;
79 QVariant data(
int role = Qt::DisplayRole )
const;
89 void addChild( std::unique_ptr< QgsRuntimeProfilerNode > child );
117 void removeChildAt(
int index );
133 void setElapsed(
double time );
140 double elapsed()
const;
146 double totalElapsedTimeForChildren(
const QString &group )
const;
149 std::deque< std::unique_ptr< QgsRuntimeProfilerNode > > mChildren;
151 QElapsedTimer mProfileTime;
195 Q_DECL_DEPRECATED
void beginGroup(
const QString &name )
SIP_DEPRECATED;
208 QStringList childGroups(
const QString &parent = QString(),
const QString &group =
"startup" )
const;
215 void start(
const QString &name,
const QString &group =
"startup" );
220 void end(
const QString &group =
"startup" );
226 double profileTime(
const QString &name,
const QString &group =
"startup" )
const;
231 void clear(
const QString &group =
"startup" );
237 double totalTime(
const QString &group =
"startup" );
242 QSet< QString >
groups()
const {
return mGroups; }
250 bool groupIsActive(
const QString &group )
const;
255 static QString translateGroupName(
const QString &group );
259 int rowCount(
const QModelIndex &parent = QModelIndex() )
const override;
260 int columnCount(
const QModelIndex &parent = QModelIndex() )
const override;
261 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex() )
const override;
262 QModelIndex parent(
const QModelIndex &child )
const override;
263 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole )
const override;
264 QVariant headerData(
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const override;
270 void started(
const QString &group,
const QStringList &path,
const QString &name );
271 void ended(
const QString &group,
const QStringList &path,
const QString &name,
double elapsed );
278 void groupAdded(
const QString &group );
282 void otherProfilerStarted(
const QString &group,
const QStringList &path,
const QString &name );
283 void otherProfilerEnded(
const QString &group,
const QStringList &path,
const QString &name,
double elapsed );
289 bool mInitialized =
false;
290 void setupConnections();
302 QMap< QString, QStack< QgsRuntimeProfilerNode * > > mCurrentStack;
303 std::unique_ptr< QgsRuntimeProfilerNode > mRootNode;
305 QSet< QString > mGroups;
352 void switchTask(
const QString &name );
361 #endif // QGSRUNTIMEPROFILER_H