From 6e1037200cc6a8e076baf4280082bf7ca4be83b3 Mon Sep 17 00:00:00 2001 From: Reece Date: Thu, 1 Jul 2021 10:24:30 +0100 Subject: [PATCH] [*] Benchmark util shouldn't double print on dtor if Finish was already called --- Include/Aurora/Time/DebugBenchmark.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Include/Aurora/Time/DebugBenchmark.hpp b/Include/Aurora/Time/DebugBenchmark.hpp index ff30c2a2..767f62b4 100644 --- a/Include/Aurora/Time/DebugBenchmark.hpp +++ b/Include/Aurora/Time/DebugBenchmark.hpp @@ -25,12 +25,14 @@ namespace Aurora::Time void Finish() { + if (std::exchange(finished_, true)) return; auto time = timer_.End(); Aurora::Console::Logging::LogDbg("[Benchmark] {} took {}", message_, ConvertMSToTimescaleEN(time)); } private: Timer timer_; + bool finished_ {}; AuString message_; };