QGIS API Documentation  3.6.0-Noosa (5873452)
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 "qgis_sip.h"
20 #include <QPair>
21 #include <QStack>
22 
23 #include "qgis_core.h"
24 
29 class CORE_EXPORT QgsRuntimeProfiler
30 {
31  public:
32 
36  QgsRuntimeProfiler() = default;
37 
43  void beginGroup( const QString &name );
44 
48  void endGroup();
49 
55  void start( const QString &name );
56 
60  void end();
61 
67  const QList<QPair<QString, double > > profileTimes() const { return mProfileTimes; } SIP_SKIP
68 
72  void clear();
73 
78  double totalTime();
79 
80  private:
81  QString mGroupPrefix;
82  QStack<QString> mGroupStack;
83  QTime mProfileTime;
84  QString mCurrentName;
85  QList<QPair<QString, double > > mProfileTimes;
86 };
87 
88 #endif // QGSRUNTIMEPROFILER_H
#define SIP_SKIP
Definition: qgis_sip.h:119
const QList< QPair< QString, double > > profileTimes() const
Returns all the current profile times.