From a421083e580c125a2438f04f8e39546a8a5a446d Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 10 Oct 2021 15:58:24 +0200 Subject: [PATCH] Crash reports may be serialized. --- client/TracyProfiler.cpp | 13 +++++++++---- common/TracyQueue.hpp | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/client/TracyProfiler.cpp b/client/TracyProfiler.cpp index 0c22f4e8..07588d4b 100644 --- a/client/TracyProfiler.cpp +++ b/client/TracyProfiler.cpp @@ -611,10 +611,10 @@ LONG WINAPI CrashFilter( PEXCEPTION_POINTERS pExp ) { GetProfiler().SendCallstack( 60, "KiUserExceptionDispatcher" ); - TracyLfqPrepare( QueueType::CrashReport ); + TracyQueuePrepare( QueueType::CrashReport ); item->crashReport.time = Profiler::GetTime(); item->crashReport.text = (uint64_t)s_crashText; - TracyLfqCommit; + TracyQueueCommit( crashReportThread ); } HANDLE h = CreateToolhelp32Snapshot( TH32CS_SNAPTHREAD, 0 ); @@ -850,10 +850,10 @@ static void CrashHandler( int signal, siginfo_t* info, void* /*ucontext*/ ) { GetProfiler().SendCallstack( 60, "__kernel_rt_sigreturn" ); - TracyLfqPrepare( QueueType::CrashReport ); + TracyQueuePrepare( QueueType::CrashReport ); item->crashReport.time = Profiler::GetTime(); item->crashReport.text = (uint64_t)s_crashText; - TracyLfqCommit; + TracyQueueCommit( crashReportThread ); } DIR* dp = opendir( "/proc/self/task" ); @@ -2486,6 +2486,11 @@ Profiler::DequeueStatus Profiler::DequeueSerial() ThreadCtxCheckSerial( messageColorLiteralThread ); break; } + case QueueType::CrashReport: + { + ThreadCtxCheckSerial( crashReportThread ); + break; + } default: break; } diff --git a/common/TracyQueue.hpp b/common/TracyQueue.hpp index 06b62c15..b6f24013 100644 --- a/common/TracyQueue.hpp +++ b/common/TracyQueue.hpp @@ -502,6 +502,11 @@ struct QueueCrashReport uint64_t text; // ptr }; +struct QueueCrashReportThread +{ + uint32_t thread; +}; + struct QueueSysTime { int64_t time; @@ -636,6 +641,7 @@ struct QueueItem QueueSymbolInformation symbolInformation; QueueCodeInformation codeInformation; QueueCrashReport crashReport; + QueueCrashReportThread crashReportThread; QueueSysTime sysTime; QueueContextSwitch contextSwitch; QueueThreadWakeup threadWakeup;