fixed mac stuff and added more debug code

This commit is contained in:
nuuls
2018-05-24 22:58:07 +02:00
committed by fourtf
parent 835b6d80da
commit 6ee4945715
7 changed files with 51 additions and 13 deletions
+21
View File
@@ -3,6 +3,7 @@
#include <QDebug>
#include <QElapsedTimer>
#include <boost/current_function.hpp>
#include <boost/noncopyable.hpp>
#define BENCH(x) \
QElapsedTimer x; \
@@ -11,3 +12,23 @@
#define MARK(x) \
qDebug() << BOOST_CURRENT_FUNCTION << __LINE__ \
<< static_cast<float>(x.nsecsElapsed()) / 100000.0 << "ms";
class BenchmarkGuard : boost::noncopyable {
QElapsedTimer timer;
QString name;
public:
BenchmarkGuard(const QString &_name)
:name(_name)
{
timer.start();
}
~BenchmarkGuard() {
qDebug() << this->name << float(timer.nsecsElapsed()) / 100000.0 << "ms";
}
qreal getElapsedMs() {
return qreal(timer.nsecsElapsed()) / 100000.0;
}
};