Commit d1c68e8b authored by Anakin's avatar Anakin

added Profiler to analyses the time used by code lines

parent 9c16aa32
#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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment