added Profiler to analyses the time used by code lines
This commit is contained in:
parent
9c16aa32f1
commit
d1c68e8ba6
|
@ -0,0 +1,36 @@
|
|||
#pragma once
|
||||
|
||||
#ifdef _DEBUG
|
||||
#include <QElapsedTimer.h>
|
||||
#include <iostream>
|
||||
#define TIC Profiler::getInstance().startTimer();
|
||||
#define TOC Profiler::getInstance().takeTime();
|
||||
|
||||
class Profiler
|
||||
{
|
||||
private:
|
||||
Profiler() { timer.start(); };
|
||||
|
||||
QElapsedTimer timer;
|
||||
|
||||
public:
|
||||
~Profiler() {};
|
||||
|
||||
static Profiler& getInstance() {
|
||||
static Profiler instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
void startTimer() {
|
||||
timer.restart();
|
||||
};
|
||||
|
||||
void takeTime() {
|
||||
std::cout << "time elapsed: " << timer.elapsed() << std::endl;
|
||||
};
|
||||
};
|
||||
|
||||
#else
|
||||
#define TIC
|
||||
#define TOC
|
||||
#endif
|
|
@ -5,6 +5,7 @@
|
|||
#include "..\Header\OutputDevice.h"
|
||||
#include <QRegExp>
|
||||
|
||||
#include "../Header/Profiler.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// constructor/destructor
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <QDropEvent>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "..\Header\Profiler.h"
|
||||
|
||||
#define DEFAULT_Z_DISTANCE -4.0
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue