Tracing: use only lower 32bits for thread, to make capture compatible with perfetto UI

This commit is contained in:
emeric
2024-03-31 13:07:02 +02:00
parent 9ca4ac073a
commit 4ba8330194
2 changed files with 25 additions and 2 deletions
+2
View File
@@ -42,6 +42,7 @@ namespace lms::core::tracing
void write(const CompleteEvent& event) override;
void dumpCurrentBuffer(std::ostream& os) override;
void setThreadName(std::thread::id id, std::string_view threadName) override;
std::uint32_t toTraceThreadId(std::thread::id threadId) const;
static constexpr std::size_t BufferSize{ 32 * 1024 };
@@ -64,6 +65,7 @@ namespace lms::core::tracing
std::mutex _threadNameMutex;
std::unordered_map<std::thread::id, std::string> _threadNames;
mutable std::unordered_map<std::thread::id, std::uint32_t> _cachedTraceThreadIds;
std::mutex _mutex;
std::deque<Buffer*> _freeBuffers;