Skip to content
Snippets Groups Projects
Commit d1c68e8b authored by Anakin's avatar Anakin
Browse files

added Profiler to analyses the time used by code lines

parent 9c16aa32
No related branches found
No related tags found
No related merge requests found
#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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment