From 592ec9b08470b4447adb4a70cc669b5d7e40fb4e Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 2 Mar 2019 14:28:58 -0500 Subject: [PATCH] logging/backend: Make time_origin a class variable instead of a local static Moves local global state into the Impl class itself and initializes it at the creation of the instance instead of in the function. This makes it nicer for weakly-ordered architectures, given the CreateEntry() class won't need to have atomic loads executed for each individual call to the CreateEntry class. --- src/common/logging/backend.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp index f0ccfbf25..e28b527ef 100644 --- a/src/common/logging/backend.cpp +++ b/src/common/logging/backend.cpp @@ -117,7 +117,6 @@ private: // matches from the beginning up to the last '../' or 'src/' static const std::regex trim_source_path(R"(.*([\/\\]|^)((\.\.)|(src))[\/\\])"); - static steady_clock::time_point time_origin = steady_clock::now(); Entry entry; entry.timestamp = @@ -137,6 +136,7 @@ private: std::vector> backends; Common::MPSCQueue message_queue; Filter filter; + std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()}; }; void ConsoleBackend::Write(const Entry& entry) {