[*] Benchmark util shouldn't double print on dtor if Finish was already called

This commit is contained in:
Reece Wilson 2021-07-01 10:24:30 +01:00
parent 9a93d4ec8d
commit 6e1037200c

View File

@ -25,12 +25,14 @@ namespace Aurora::Time
void Finish() void Finish()
{ {
if (std::exchange(finished_, true)) return;
auto time = timer_.End(); auto time = timer_.End();
Aurora::Console::Logging::LogDbg("[Benchmark] {} took {}", message_, ConvertMSToTimescaleEN(time)); Aurora::Console::Logging::LogDbg("[Benchmark] {} took {}", message_, ConvertMSToTimescaleEN(time));
} }
private: private:
Timer timer_; Timer timer_;
bool finished_ {};
AuString message_; AuString message_;
}; };