aboutsummaryrefslogtreecommitdiff
path: root/src/common/logging/backend.cpp
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-03-02 14:28:58 -0500
committerLioncash <mathew1800@gmail.com>2019-03-02 14:44:24 -0500
commitf8f1ff0b4f79a6c8807c3bca71e9a7a3ec4bff69 (patch)
treed6da2afbfecd91459070227a31010ab37bb36e20 /src/common/logging/backend.cpp
parent43c1092031a7e0ad2ac9f45a651b97ce19102bb6 (diff)
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.
Diffstat (limited to 'src/common/logging/backend.cpp')
-rw-r--r--src/common/logging/backend.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/common/logging/backend.cpp b/src/common/logging/backend.cpp
index 555addb959..4462ff3fbd 100644
--- a/src/common/logging/backend.cpp
+++ b/src/common/logging/backend.cpp
@@ -115,8 +115,6 @@ private:
using std::chrono::duration_cast;
using std::chrono::steady_clock;
- static steady_clock::time_point time_origin = steady_clock::now();
-
Entry entry;
entry.timestamp =
duration_cast<std::chrono::microseconds>(steady_clock::now() - time_origin);
@@ -135,6 +133,7 @@ private:
std::vector<std::unique_ptr<Backend>> backends;
Common::MPSCQueue<Log::Entry> message_queue;
Filter filter;
+ std::chrono::steady_clock::time_point time_origin{std::chrono::steady_clock::now()};
};
void ConsoleBackend::Write(const Entry& entry) {