QGIS API Documentation  3.12.1-BucureČ™ti (121cc00ff0)
qgsruntimeprofiler.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsruntimeprofiler.h
3  ---------------------
4  begin : June 2016
5  copyright : (C) 2016 by Nathan Woodrow
6  email : woodrow dot nathan at gmail dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 #ifndef QGSRUNTIMEPROFILER_H
16 #define QGSRUNTIMEPROFILER_H
17 
18 #include <QTime>
19 #include <QElapsedTimer>
20 #include "qgis_sip.h"
21 #include <QPair>
22 #include <QStack>
23 #include <QList>
24 
25 #include "qgis_core.h"
26 
31 class CORE_EXPORT QgsRuntimeProfiler
32 {
33  public:
34 
38  QgsRuntimeProfiler() = default;
39 
45  void beginGroup( const QString &name );
46 
50  void endGroup();
51 
57  void start( const QString &name );
58 
62  void end();
63 
69  const QList<QPair<QString, double > > profileTimes() const { return mProfileTimes; } SIP_SKIP
70 
74  void clear();
75 
80  double totalTime();
81 
82  private:
83  QString mGroupPrefix;
84  QStack<QString> mGroupStack;
85  QElapsedTimer mProfileTime;
86  QString mCurrentName;
87  QList<QPair<QString, double > > mProfileTimes;
88 };
89 
90 #endif // QGSRUNTIMEPROFILER_H
#define SIP_SKIP
Definition: qgis_sip.h:126
const QList< QPair< QString, double > > profileTimes() const
Returns all the current profile times.