From c869b1bf5a9c7d40e0e3f61612abc1b34fd35883 Mon Sep 17 00:00:00 2001 From: xavier Date: Fri, 21 May 2021 20:57:39 +0200 Subject: [PATCH] add TRACY_CALLSTACK_IGNORE_INLINES to tradeoff speed vs precision in win32 DecodeCallstackPtr() SymQueryInlineTrace() is too slow in some cases: 300000 queries backlog getting processed at ~70 per second is prohibitive. (without inlines resolution, it's more like ~20000 queries per second) --- client/TracyCallstack.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/client/TracyCallstack.cpp b/client/TracyCallstack.cpp index 4c87e6c7..d0220113 100644 --- a/client/TracyCallstack.cpp +++ b/client/TracyCallstack.cpp @@ -81,6 +81,7 @@ extern "C" t_RtlWalkFrameChain RtlWalkFrameChain = 0; } +#ifndef TRACY_CALLSTACK_IGNORE_INLINES #if defined __MINGW32__ && API_VERSION_NUMBER < 12 extern "C" { // Actual required API_VERSION_NUMBER is unknown because it is undocumented. These functions are not present in at least v11. @@ -93,6 +94,7 @@ BOOL IMAGEAPI SymGetLineFromInlineContext(HANDLE hProcess, DWORD64 qwAddr, ULONG DWORD64 qwModuleBaseAddress, PDWORD pdwDisplacement, PIMAGEHLP_LINE64 Line64); }; #endif +#endif #ifndef __CYGWIN__ struct ModuleCache @@ -292,7 +294,7 @@ CallstackSymbolData DecodeCodeAddress( uint64_t ptr ) #ifdef TRACY_DBGHELP_LOCK DBGHELP_LOCK; #endif -#ifndef __CYGWIN__ +#if !defined(__CYGWIN__) && !defined(TRACY_CALLSTACK_IGNORE_INLINES) DWORD inlineNum = SymAddrIncludeInlineTrace( proc, ptr ); DWORD ctx = 0; DWORD idx; @@ -335,7 +337,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr ) #ifdef TRACY_DBGHELP_LOCK DBGHELP_LOCK; #endif -#ifndef __CYGWIN__ +#if !defined(__CYGWIN__) && !defined(TRACY_CALLSTACK_IGNORE_INLINES) DWORD inlineNum = SymAddrIncludeInlineTrace( proc, ptr ); if( inlineNum > MaxCbTrace - 1 ) inlineNum = MaxCbTrace - 1; DWORD ctx = 0; @@ -393,7 +395,7 @@ CallstackEntryData DecodeCallstackPtr( uint64_t ptr ) } } -#ifndef __CYGWIN__ +#if !defined(__CYGWIN__) && !defined(TRACY_CALLSTACK_IGNORE_INLINES) if( doInline ) { for( DWORD i=0; i