mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
1.Fix crash on android by not initialize the tpmalloc in some thread 2.Fix initialization order problem in TRACY_DELAYED_INIT 3.Some warning fix
This commit is contained in:
parent
bb25687f7e
commit
6f7ecd6073
@ -163,6 +163,7 @@ void InitCallstack()
|
|||||||
|
|
||||||
TRACY_API uintptr_t* CallTrace( int depth )
|
TRACY_API uintptr_t* CallTrace( int depth )
|
||||||
{
|
{
|
||||||
|
InitRPMallocThread();
|
||||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
||||||
const auto num = RtlWalkFrameChain( (void**)( trace + 1 ), depth, 0 );
|
const auto num = RtlWalkFrameChain( (void**)( trace + 1 ), depth, 0 );
|
||||||
*trace = num;
|
*trace = num;
|
||||||
|
|||||||
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
TRACY_API void InitRPMallocThread();
|
||||||
|
|
||||||
struct CallstackSymbolData
|
struct CallstackSymbolData
|
||||||
{
|
{
|
||||||
@ -83,6 +84,8 @@ static _Unwind_Reason_Code tracy_unwind_callback( struct _Unwind_Context* ctx, v
|
|||||||
|
|
||||||
static tracy_force_inline void* Callstack( int depth )
|
static tracy_force_inline void* Callstack( int depth )
|
||||||
{
|
{
|
||||||
|
InitRPMallocThread();
|
||||||
|
|
||||||
assert( depth >= 1 && depth < 63 );
|
assert( depth >= 1 && depth < 63 );
|
||||||
|
|
||||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
auto trace = (uintptr_t*)tracy_malloc( ( 1 + depth ) * sizeof( uintptr_t ) );
|
||||||
@ -98,6 +101,8 @@ static tracy_force_inline void* Callstack( int depth )
|
|||||||
|
|
||||||
static tracy_force_inline void* Callstack( int depth )
|
static tracy_force_inline void* Callstack( int depth )
|
||||||
{
|
{
|
||||||
|
InitRPMallocThread();
|
||||||
|
|
||||||
assert( depth >= 1 );
|
assert( depth >= 1 );
|
||||||
|
|
||||||
auto trace = (uintptr_t*)tracy_malloc( ( 1 + (size_t)depth ) * sizeof( uintptr_t ) );
|
auto trace = (uintptr_t*)tracy_malloc( ( 1 + (size_t)depth ) * sizeof( uintptr_t ) );
|
||||||
|
|||||||
@ -364,7 +364,7 @@ static const char* GetHostInfo()
|
|||||||
# elif defined __MINGW32__
|
# elif defined __MINGW32__
|
||||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (MingW)\n", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (int)ver.dwBuildNumber );
|
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (MingW)\n", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (int)ver.dwBuildNumber );
|
||||||
# else
|
# else
|
||||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
ptr += sprintf( ptr, "OS: Windows %i.%i.%i\n", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (int)ver.dwBuildNumber );
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
@ -1007,6 +1007,7 @@ TRACY_API void StartupProfiler()
|
|||||||
s_profilerData = (ProfilerData*)tracy_malloc( sizeof( ProfilerData ) );
|
s_profilerData = (ProfilerData*)tracy_malloc( sizeof( ProfilerData ) );
|
||||||
new (s_profilerData) ProfilerData();
|
new (s_profilerData) ProfilerData();
|
||||||
s_profilerData->profiler.SpawnWorkerThreads();
|
s_profilerData->profiler.SpawnWorkerThreads();
|
||||||
|
s_instance = &s_profilerData->profiler;
|
||||||
}
|
}
|
||||||
static ProfilerData& GetProfilerData()
|
static ProfilerData& GetProfilerData()
|
||||||
{
|
{
|
||||||
@ -1219,7 +1220,6 @@ Profiler::Profiler()
|
|||||||
, m_queryData( nullptr )
|
, m_queryData( nullptr )
|
||||||
{
|
{
|
||||||
assert( !s_instance );
|
assert( !s_instance );
|
||||||
s_instance = this;
|
|
||||||
|
|
||||||
#ifndef TRACY_DELAYED_INIT
|
#ifndef TRACY_DELAYED_INIT
|
||||||
# ifdef _MSC_VER
|
# ifdef _MSC_VER
|
||||||
@ -1250,6 +1250,7 @@ Profiler::Profiler()
|
|||||||
|
|
||||||
#if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME)
|
#if !defined(TRACY_DELAYED_INIT) || !defined(TRACY_MANUAL_LIFETIME)
|
||||||
SpawnWorkerThreads();
|
SpawnWorkerThreads();
|
||||||
|
s_instance = this;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user