39 lines
821 B
C++
39 lines
821 B
C++
|
|
#ifndef FAVPROFILE_H
|
|
#define FAVPROFILE_H
|
|
#if (PROFILE_BUILD)
|
|
|
|
#include <QObject>
|
|
#include <QElapsedTimer>
|
|
|
|
class FAVProfile : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
static FAVProfile* instance()
|
|
{
|
|
static FAVProfile * _instance = 0;
|
|
if ( _instance == NULL ) {
|
|
_instance = new FAVProfile();
|
|
}
|
|
return _instance;
|
|
}
|
|
static qint64 elapsed(QString msg);
|
|
static void restart(QString msg);
|
|
static qint64 elapsed() {
|
|
return instance()->_timer.elapsed();
|
|
}
|
|
static void lapStart() {
|
|
instance()->_lastLap = FAVProfile::elapsed();
|
|
}
|
|
static void lapEnd(QString msg);
|
|
private:
|
|
QElapsedTimer _timer;
|
|
qint64 _lastLap;
|
|
explicit FAVProfile(QObject *parent = nullptr);
|
|
signals:
|
|
};
|
|
|
|
#endif // PROFILE_BUILD
|
|
#endif // FAVPROFILE_H
|