mirror-chatterino2/lib/appbase/debug/Benchmark.cpp
2019-09-08 22:27:57 +02:00

22 lines
389 B
C++

#include "Benchmark.hpp"
namespace AB_NAMESPACE {
BenchmarkGuard::BenchmarkGuard(const QString &_name)
: name_(_name)
{
timer_.start();
}
BenchmarkGuard::~BenchmarkGuard()
{
log("{} {} ms", this->name_, float(timer_.nsecsElapsed()) / 1000000.0f);
}
qreal BenchmarkGuard::getElapsedMs()
{
return qreal(timer_.nsecsElapsed()) / 1000000.0;
}
} // namespace AB_NAMESPACE