mirror of
https://github.com/wolfpld/tracy
synced 2025-05-01 05:03:53 +00:00
Fix compiling TracyClient.cpp on UWP with defined TRACY_ENABLE
This commit is contained in:
parent
10b3d7ad82
commit
7169f5f30a
@ -6,7 +6,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
|
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||||
|
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
|
# else
|
||||||
# define TRACY_HAS_CALLSTACK 1
|
# define TRACY_HAS_CALLSTACK 1
|
||||||
|
# endif
|
||||||
#elif defined __ANDROID__
|
#elif defined __ANDROID__
|
||||||
# if !defined __arm__ || __ANDROID_API__ >= 21
|
# if !defined __arm__ || __ANDROID_API__ >= 21
|
||||||
# define TRACY_HAS_CALLSTACK 2
|
# define TRACY_HAS_CALLSTACK 2
|
||||||
|
@ -9,6 +9,11 @@
|
|||||||
# include <tlhelp32.h>
|
# include <tlhelp32.h>
|
||||||
# include <inttypes.h>
|
# include <inttypes.h>
|
||||||
# include <intrin.h>
|
# include <intrin.h>
|
||||||
|
|
||||||
|
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||||
|
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
|
# define TRACY_ON_UWP
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
@ -314,7 +319,9 @@ static void InitFailure( const char* msg )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
# if !defined TRACY_ON_UWP
|
||||||
MessageBoxA( nullptr, msg, "Tracy Profiler initialization failure", MB_ICONSTOP );
|
MessageBoxA( nullptr, msg, "Tracy Profiler initialization failure", MB_ICONSTOP );
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf( stderr, "Tracy Profiler initialization failure: %s\n", msg );
|
fprintf( stderr, "Tracy Profiler initialization failure: %s\n", msg );
|
||||||
@ -440,6 +447,9 @@ static const char* GetHostInfo()
|
|||||||
static char buf[1024];
|
static char buf[1024];
|
||||||
auto ptr = buf;
|
auto ptr = buf;
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
|
# if defined TRACY_ON_UWP
|
||||||
|
ptr += sprintf(ptr, "OS: Windows 10\n");
|
||||||
|
# else
|
||||||
t_RtlGetVersion RtlGetVersion = (t_RtlGetVersion)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlGetVersion" );
|
t_RtlGetVersion RtlGetVersion = (t_RtlGetVersion)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlGetVersion" );
|
||||||
if( !RtlGetVersion )
|
if( !RtlGetVersion )
|
||||||
{
|
{
|
||||||
@ -460,6 +470,7 @@ static const char* GetHostInfo()
|
|||||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
ptr += sprintf( ptr, "OS: Windows %i.%i.%i\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
struct utsname utsName;
|
struct utsname utsName;
|
||||||
uname( &utsName );
|
uname( &utsName );
|
||||||
@ -508,11 +519,15 @@ static const char* GetHostInfo()
|
|||||||
char hostname[512];
|
char hostname[512];
|
||||||
gethostname( hostname, 512 );
|
gethostname( hostname, 512 );
|
||||||
|
|
||||||
|
# if defined TRACY_ON_UWP
|
||||||
|
ptr += sprintf(ptr, "Hostname: %s\n", hostname);
|
||||||
|
# else
|
||||||
DWORD userSz = UNLEN+1;
|
DWORD userSz = UNLEN+1;
|
||||||
char user[UNLEN+1];
|
char user[UNLEN+1];
|
||||||
GetUserNameA( user, &userSz );
|
GetUserNameA( user, &userSz );
|
||||||
|
|
||||||
ptr += sprintf( ptr, "User: %s@%s\n", user, hostname );
|
ptr += sprintf( ptr, "User: %s@%s\n", user, hostname );
|
||||||
|
# endif
|
||||||
#else
|
#else
|
||||||
char hostname[_POSIX_HOST_NAME_MAX]{};
|
char hostname[_POSIX_HOST_NAME_MAX]{};
|
||||||
char user[_POSIX_LOGIN_NAME_MAX]{};
|
char user[_POSIX_LOGIN_NAME_MAX]{};
|
||||||
@ -707,7 +722,7 @@ static BroadcastMessage& GetBroadcastMessage( const char* procname, size_t pnsz,
|
|||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32 && !defined TRACY_ON_UWP
|
||||||
static DWORD s_profilerThreadId = 0;
|
static DWORD s_profilerThreadId = 0;
|
||||||
static char s_crashText[1024];
|
static char s_crashText[1024];
|
||||||
|
|
||||||
@ -1382,7 +1397,7 @@ void Profiler::SpawnWorkerThreads()
|
|||||||
new(s_symbolThread) Thread( LaunchSymbolWorker, this );
|
new(s_symbolThread) Thread( LaunchSymbolWorker, this );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32 && !defined TRACY_ON_UWP
|
||||||
s_profilerThreadId = GetThreadId( s_thread->Handle() );
|
s_profilerThreadId = GetThreadId( s_thread->Handle() );
|
||||||
m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter );
|
m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter );
|
||||||
#endif
|
#endif
|
||||||
@ -1416,7 +1431,7 @@ Profiler::~Profiler()
|
|||||||
{
|
{
|
||||||
m_shutdown.store( true, std::memory_order_relaxed );
|
m_shutdown.store( true, std::memory_order_relaxed );
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32 && !defined TRACY_ON_UWP
|
||||||
if( m_crashHandlerInstalled ) RemoveVectoredExceptionHandler( m_exceptionHandler );
|
if( m_crashHandlerInstalled ) RemoveVectoredExceptionHandler( m_exceptionHandler );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -3534,7 +3549,11 @@ void Profiler::ReportTopology()
|
|||||||
};
|
};
|
||||||
|
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
|
# if defined TRACY_ON_UWP
|
||||||
|
t_GetLogicalProcessorInformationEx _GetLogicalProcessorInformationEx = &::GetLogicalProcessorInformationEx;
|
||||||
|
# else
|
||||||
t_GetLogicalProcessorInformationEx _GetLogicalProcessorInformationEx = (t_GetLogicalProcessorInformationEx)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetLogicalProcessorInformationEx" );
|
t_GetLogicalProcessorInformationEx _GetLogicalProcessorInformationEx = (t_GetLogicalProcessorInformationEx)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetLogicalProcessorInformationEx" );
|
||||||
|
# endif
|
||||||
if( !_GetLogicalProcessorInformationEx ) return;
|
if( !_GetLogicalProcessorInformationEx ) return;
|
||||||
|
|
||||||
DWORD psz = 0;
|
DWORD psz = 0;
|
||||||
|
@ -2,8 +2,12 @@
|
|||||||
#define __TRACYSYSTRACE_HPP__
|
#define __TRACYSYSTRACE_HPP__
|
||||||
|
|
||||||
#if !defined TRACY_NO_SYSTEM_TRACING && ( defined _WIN32 || defined __linux__ )
|
#if !defined TRACY_NO_SYSTEM_TRACING && ( defined _WIN32 || defined __linux__ )
|
||||||
|
# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && \
|
||||||
|
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||||
|
# else
|
||||||
# define TRACY_HAS_SYSTEM_TRACING
|
# define TRACY_HAS_SYSTEM_TRACING
|
||||||
# endif
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef TRACY_HAS_SYSTEM_TRACING
|
#ifdef TRACY_HAS_SYSTEM_TRACING
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user