mirror-chatterino2/src/debug/Benchmark.cpp

23 lines
403 B
C++
Raw Normal View History

#include "Benchmark.hpp"
2019-10-07 15:46:08 +02:00
namespace chatterino {
BenchmarkGuard::BenchmarkGuard(const QString &_name)
: name_(_name)
{
timer_.start();
}
BenchmarkGuard::~BenchmarkGuard()
{
qDebug() << this->name_ << float(timer_.nsecsElapsed()) / 1000000.0f
<< "ms";
}
qreal BenchmarkGuard::getElapsedMs()
{
return qreal(timer_.nsecsElapsed()) / 1000000.0;
}
2019-10-07 15:46:08 +02:00
} // namespace chatterino