mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Drop support for Cygwin.
This commit is contained in:
@@ -115,7 +115,7 @@ extern "C"
|
||||
t_SymGetLineFromInlineContext _SymGetLineFromInlineContext = 0;
|
||||
}
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
|
||||
struct ModuleCache
|
||||
{
|
||||
uint64_t start;
|
||||
@@ -134,7 +134,7 @@ struct KernelDriver
|
||||
|
||||
KernelDriver* s_krnlCache = nullptr;
|
||||
size_t s_krnlCacheCnt;
|
||||
#endif
|
||||
|
||||
|
||||
void InitCallstack()
|
||||
{
|
||||
@@ -152,7 +152,6 @@ void InitCallstack()
|
||||
SymInitialize( GetCurrentProcess(), nullptr, true );
|
||||
SymSetOptions( SYMOPT_LOAD_LINES );
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
DWORD needed;
|
||||
LPVOID dev[4096];
|
||||
if( EnumDeviceDrivers( dev, sizeof(dev), &needed ) != 0 )
|
||||
@@ -231,7 +230,6 @@ void InitCallstack()
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef TRACY_DBGHELP_LOCK
|
||||
DBGHELP_UNLOCK;
|
||||
@@ -278,7 +276,6 @@ static const char* GetModuleName( uint64_t addr )
|
||||
{
|
||||
if( ( addr >> 63 ) != 0 )
|
||||
{
|
||||
#ifndef __CYGWIN__
|
||||
if( s_krnlCache )
|
||||
{
|
||||
auto it = std::lower_bound( s_krnlCache, s_krnlCache + s_krnlCacheCnt, addr, []( const KernelDriver& lhs, const uint64_t& rhs ) { return lhs.addr > rhs; } );
|
||||
@@ -287,11 +284,9 @@ static const char* GetModuleName( uint64_t addr )
|
||||
return it->mod;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return "<kernel>";
|
||||
}
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
for( auto& v : *s_modCache )
|
||||
{
|
||||
if( addr >= v.start && addr < v.end )
|
||||
@@ -338,8 +333,6 @@ static const char* GetModuleName( uint64_t addr )
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return "[unknown]";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef __TRACYCALLSTACK_H__
|
||||
#define __TRACYCALLSTACK_H__
|
||||
|
||||
#if !defined _WIN32 && !defined __CYGWIN__
|
||||
#if !defined _WIN32
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
# define TRACY_HAS_CALLSTACK 1
|
||||
#elif defined __ANDROID__
|
||||
# if !defined __arm__ || __ANDROID_API__ >= 21
|
||||
|
||||
+21
-37
@@ -14,12 +14,6 @@
|
||||
# include <sys/param.h>
|
||||
#endif
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
# include <windows.h>
|
||||
# include <unistd.h>
|
||||
# include <tlhelp32.h>
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
# include <errno.h>
|
||||
#endif
|
||||
@@ -95,7 +89,7 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
# include <lmcons.h>
|
||||
extern "C" typedef LONG (WINAPI *t_RtlGetVersion)( PRTL_OSVERSIONINFOW );
|
||||
extern "C" typedef BOOL (WINAPI *t_GetLogicalProcessorInformationEx)( LOGICAL_PROCESSOR_RELATIONSHIP, PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, PDWORD );
|
||||
@@ -108,11 +102,11 @@ extern "C" typedef BOOL (WINAPI *t_GetLogicalProcessorInformationEx)( LOGICAL_PR
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
|
||||
#if !defined _WIN32 && !defined __CYGWIN__ && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
|
||||
#if !defined _WIN32 && ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 )
|
||||
# include <cpuid.h>
|
||||
#endif
|
||||
|
||||
#if !( ( ( defined _WIN32 || defined __CYGWIN__ ) && _WIN32_WINNT >= _WIN32_WINNT_VISTA ) || defined __linux__ )
|
||||
#if !( ( defined _WIN32 && _WIN32_WINNT >= _WIN32_WINNT_VISTA ) || defined __linux__ )
|
||||
# include <mutex>
|
||||
#endif
|
||||
|
||||
@@ -142,7 +136,7 @@ struct ThreadHandleWrapper
|
||||
static inline void CpuId( uint32_t* regs, uint32_t leaf )
|
||||
{
|
||||
memset(regs, 0, sizeof(uint32_t) * 4);
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
__cpuidex( (int*)regs, leaf, 0 );
|
||||
#else
|
||||
__get_cpuid( leaf, regs, regs+1, regs+2, regs+3 );
|
||||
@@ -151,7 +145,7 @@ static inline void CpuId( uint32_t* regs, uint32_t leaf )
|
||||
|
||||
static void InitFailure( const char* msg )
|
||||
{
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
bool hasConsole = false;
|
||||
bool reopen = false;
|
||||
const auto attached = AttachConsole( ATTACH_PARENT_PROCESS );
|
||||
@@ -199,7 +193,7 @@ static int64_t SetupHwTimer()
|
||||
const char* noCheck = GetEnvVar( "TRACY_NO_INVARIANT_CHECK" );
|
||||
if( !noCheck || noCheck[0] != '1' )
|
||||
{
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
InitFailure( "CPU doesn't support invariant TSC.\nDefine TRACY_NO_INVARIANT_CHECK=1 to ignore this error, *if you know what you are doing*.\nAlternatively you may rebuild the application with the TRACY_TIMER_QPC or TRACY_TIMER_FALLBACK define to use lower resolution timer." );
|
||||
#else
|
||||
InitFailure( "CPU doesn't support invariant TSC.\nDefine TRACY_NO_INVARIANT_CHECK=1 to ignore this error, *if you know what you are doing*.\nAlternatively you may rebuild the application with the TRACY_TIMER_FALLBACK define to use lower resolution timer." );
|
||||
@@ -233,7 +227,7 @@ static const char* GetProcessName()
|
||||
auto buf = getprogname();
|
||||
if( buf ) processName = buf;
|
||||
# endif
|
||||
#elif defined _GNU_SOURCE || defined __CYGWIN__
|
||||
#elif defined _GNU_SOURCE
|
||||
if( program_invocation_short_name ) processName = program_invocation_short_name;
|
||||
#elif defined __APPLE__ || defined BSD
|
||||
auto buf = getprogname();
|
||||
@@ -250,7 +244,7 @@ static const char* GetProcessExecutablePath()
|
||||
return buf;
|
||||
#elif defined __ANDROID__
|
||||
return nullptr;
|
||||
#elif defined _GNU_SOURCE || defined __CYGWIN__
|
||||
#elif defined _GNU_SOURCE
|
||||
return program_invocation_name;
|
||||
#elif defined __APPLE__
|
||||
static char buf[1024];
|
||||
@@ -304,13 +298,11 @@ static const char* GetHostInfo()
|
||||
{
|
||||
static char buf[1024];
|
||||
auto ptr = buf;
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
t_RtlGetVersion RtlGetVersion = (t_RtlGetVersion)GetProcAddress( GetModuleHandleA( "ntdll.dll" ), "RtlGetVersion" );
|
||||
if( !RtlGetVersion )
|
||||
{
|
||||
# ifdef __CYGWIN__
|
||||
ptr += sprintf( ptr, "OS: Windows (Cygwin)\n" );
|
||||
# elif defined __MINGW32__
|
||||
# ifdef __MINGW32__
|
||||
ptr += sprintf( ptr, "OS: Windows (MingW)\n" );
|
||||
# else
|
||||
ptr += sprintf( ptr, "OS: Windows\n" );
|
||||
@@ -321,9 +313,7 @@ static const char* GetHostInfo()
|
||||
RTL_OSVERSIONINFOW ver = { sizeof( RTL_OSVERSIONINFOW ) };
|
||||
RtlGetVersion( &ver );
|
||||
|
||||
# ifdef __CYGWIN__
|
||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (Cygwin)\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
||||
# elif defined __MINGW32__
|
||||
# ifdef __MINGW32__
|
||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i (MingW)\n", (int)ver.dwMajorVersion, (int)ver.dwMinorVersion, (int)ver.dwBuildNumber );
|
||||
# else
|
||||
ptr += sprintf( ptr, "OS: Windows %i.%i.%i\n", ver.dwMajorVersion, ver.dwMinorVersion, ver.dwBuildNumber );
|
||||
@@ -371,10 +361,9 @@ static const char* GetHostInfo()
|
||||
ptr += sprintf( ptr, "Compiler: unknown\n" );
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
# ifndef __CYGWIN__
|
||||
#if defined _WIN32
|
||||
InitWinSock();
|
||||
# endif
|
||||
|
||||
char hostname[512];
|
||||
gethostname( hostname, 512 );
|
||||
|
||||
@@ -492,7 +481,7 @@ static const char* GetHostInfo()
|
||||
|
||||
ptr += sprintf( ptr, "CPU cores: %i\n", std::thread::hardware_concurrency() );
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
MEMORYSTATUSEX statex;
|
||||
statex.dwLength = sizeof( statex );
|
||||
GlobalMemoryStatusEx( &statex );
|
||||
@@ -524,7 +513,7 @@ static const char* GetHostInfo()
|
||||
|
||||
static uint64_t GetPid()
|
||||
{
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
return uint64_t( GetCurrentProcessId() );
|
||||
#else
|
||||
return uint64_t( getpid() );
|
||||
@@ -562,7 +551,7 @@ static BroadcastMessage& GetBroadcastMessage( const char* procname, size_t pnsz,
|
||||
return msg;
|
||||
}
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
static DWORD s_profilerThreadId = 0;
|
||||
static char s_crashText[1024];
|
||||
|
||||
@@ -914,7 +903,7 @@ TRACY_API bool ProfilerAvailable() { return s_instance != nullptr; }
|
||||
|
||||
TRACY_API int64_t GetFrequencyQpc()
|
||||
{
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
LARGE_INTEGER t;
|
||||
QueryPerformanceFrequency( &t );
|
||||
return t.QuadPart;
|
||||
@@ -1127,12 +1116,7 @@ TRACY_API int64_t GetInitTime() { return s_initTime.val; }
|
||||
TRACY_API std::atomic<uint32_t>& GetLockCounter() { return s_lockCounter; }
|
||||
TRACY_API std::atomic<uint8_t>& GetGpuCtxCounter() { return s_gpuCtxCounter; }
|
||||
TRACY_API GpuCtxWrapper& GetGpuCtx() { return s_gpuCtx; }
|
||||
# ifdef __CYGWIN__
|
||||
// Hackfix for cygwin reporting memory frees without matching allocations. WTF?
|
||||
TRACY_API uint64_t GetThreadHandle() { return detail::GetThreadHandleImpl(); }
|
||||
# else
|
||||
TRACY_API uint64_t GetThreadHandle() { return s_threadHandle.val; }
|
||||
# endif
|
||||
|
||||
std::atomic<ThreadNameData*>& GetThreadNameData() { return s_threadNameData; }
|
||||
|
||||
@@ -1229,7 +1213,7 @@ void Profiler::SpawnWorkerThreads()
|
||||
new(s_compressThread) Thread( LaunchCompressWorker, this );
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
s_profilerThreadId = GetThreadId( s_thread->Handle() );
|
||||
m_exceptionHandler = AddVectoredExceptionHandler( 1, CrashFilter );
|
||||
#endif
|
||||
@@ -1263,7 +1247,7 @@ Profiler::~Profiler()
|
||||
{
|
||||
m_shutdown.store( true, std::memory_order_relaxed );
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
if( m_crashHandlerInstalled ) RemoveVectoredExceptionHandler( m_exceptionHandler );
|
||||
#endif
|
||||
|
||||
@@ -2899,7 +2883,7 @@ void Profiler::ReportTopology()
|
||||
uint32_t thread;
|
||||
};
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
t_GetLogicalProcessorInformationEx _GetLogicalProcessorInformationEx = (t_GetLogicalProcessorInformationEx)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetLogicalProcessorInformationEx" );
|
||||
if( !_GetLogicalProcessorInformationEx ) return;
|
||||
|
||||
@@ -3344,7 +3328,7 @@ void Profiler::SendCodeLocation( uint64_t ptr )
|
||||
#endif
|
||||
}
|
||||
|
||||
#if ( defined _WIN32 || defined __CYGWIN__ ) && defined TRACY_TIMER_QPC
|
||||
#if defined _WIN32 && defined TRACY_TIMER_QPC
|
||||
int64_t Profiler::GetTimeQpc()
|
||||
{
|
||||
LARGE_INTEGER t;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "../common/TracyMutex.hpp"
|
||||
#include "../common/TracyProtocol.hpp"
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
#ifdef __APPLE__
|
||||
@@ -25,7 +25,7 @@
|
||||
# include <mach/mach_time.h>
|
||||
#endif
|
||||
|
||||
#if !defined TRACY_TIMER_FALLBACK && ( defined _WIN32 || defined __CYGWIN__ || ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) || ( defined TARGET_OS_IOS && TARGET_OS_IOS == 1 ) )
|
||||
#if !defined TRACY_TIMER_FALLBACK && ( defined _WIN32 || ( defined __i386 || defined _M_IX86 || defined __x86_64__ || defined _M_X64 ) || ( defined TARGET_OS_IOS && TARGET_OS_IOS == 1 ) )
|
||||
# define TRACY_HW_TIMER
|
||||
#endif
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
#ifdef TRACY_HW_TIMER
|
||||
# if defined TARGET_OS_IOS && TARGET_OS_IOS == 1
|
||||
return mach_absolute_time();
|
||||
# elif defined _WIN32 || defined __CYGWIN__
|
||||
# elif defined _WIN32
|
||||
# ifdef TRACY_TIMER_QPC
|
||||
return GetTimeQpc();
|
||||
# else
|
||||
@@ -748,7 +748,7 @@ private:
|
||||
GetProfiler().m_serialQueue.commit_next();
|
||||
}
|
||||
|
||||
#if ( defined _WIN32 || defined __CYGWIN__ ) && defined TRACY_TIMER_QPC
|
||||
#if defined _WIN32 && defined TRACY_TIMER_QPC
|
||||
static int64_t GetTimeQpc();
|
||||
#endif
|
||||
|
||||
@@ -812,7 +812,7 @@ private:
|
||||
char* m_queryData;
|
||||
char* m_queryDataPtr;
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
void* m_exceptionHandler;
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#ifdef TRACY_HAS_SYSTIME
|
||||
|
||||
# if defined _WIN32 || defined __CYGWIN__
|
||||
# if defined _WIN32
|
||||
# include <windows.h>
|
||||
# elif defined __linux__
|
||||
# include <stdio.h>
|
||||
@@ -18,7 +18,7 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
# if defined _WIN32 || defined __CYGWIN__
|
||||
# if defined _WIN32
|
||||
|
||||
static inline uint64_t ConvertTime( const FILETIME& t )
|
||||
{
|
||||
@@ -95,7 +95,7 @@ float SysTime::Get()
|
||||
const auto diffIdle = idle - oldIdle;
|
||||
const auto diffUsed = used - oldUsed;
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
return diffUsed == 0 ? -1 : ( diffUsed - diffIdle ) * 100.f / diffUsed;
|
||||
#elif defined __linux__ || defined __APPLE__ || defined BSD
|
||||
const auto total = diffUsed + diffIdle;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __TRACYSYSTIME_HPP__
|
||||
#define __TRACYSYSTIME_HPP__
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__ || defined __linux__ || defined __APPLE__
|
||||
#if defined _WIN32 || defined __linux__ || defined __APPLE__
|
||||
# define TRACY_HAS_SYSTIME
|
||||
#else
|
||||
# include <sys/param.h>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#ifdef TRACY_HAS_SYSTEM_TRACING
|
||||
|
||||
#ifndef TRACY_SAMPLING_HZ
|
||||
# if defined _WIN32 || defined __CYGWIN__
|
||||
# if defined _WIN32
|
||||
# define TRACY_SAMPLING_HZ 8000
|
||||
# elif defined __linux__
|
||||
# define TRACY_SAMPLING_HZ 10000
|
||||
@@ -17,7 +17,7 @@ namespace tracy
|
||||
|
||||
static constexpr int GetSamplingFrequency()
|
||||
{
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
return TRACY_SAMPLING_HZ > 8000 ? 8000 : ( TRACY_SAMPLING_HZ < 1 ? 1 : TRACY_SAMPLING_HZ );
|
||||
#else
|
||||
return TRACY_SAMPLING_HZ > 1000000 ? 1000000 : ( TRACY_SAMPLING_HZ < 1 ? 1 : TRACY_SAMPLING_HZ );
|
||||
@@ -31,7 +31,7 @@ static constexpr int GetSamplingPeriod()
|
||||
|
||||
}
|
||||
|
||||
# if defined _WIN32 || defined __CYGWIN__
|
||||
# if defined _WIN32
|
||||
|
||||
# ifndef NOMINMAX
|
||||
# define NOMINMAX
|
||||
@@ -129,14 +129,6 @@ struct VSyncInfo
|
||||
uint64_t flipFenceId;
|
||||
};
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
extern "C" typedef DWORD (WINAPI *t_GetProcessIdOfThread)( HANDLE );
|
||||
extern "C" typedef DWORD (WINAPI *t_GetProcessImageFileNameA)( HANDLE, LPSTR, DWORD );
|
||||
extern "C" ULONG WMIAPI TraceSetInformation(TRACEHANDLE SessionHandle, TRACE_INFO_CLASS InformationClass, PVOID TraceInformation, ULONG InformationLength);
|
||||
t_GetProcessIdOfThread GetProcessIdOfThread = (t_GetProcessIdOfThread)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "GetProcessIdOfThread" );
|
||||
t_GetProcessImageFileNameA GetProcessImageFileNameA = (t_GetProcessImageFileNameA)GetProcAddress( GetModuleHandleA( "kernel32.dll" ), "K32GetProcessImageFileNameA" );
|
||||
#endif
|
||||
|
||||
extern "C" typedef NTSTATUS (WINAPI *t_NtQueryInformationThread)( HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG );
|
||||
extern "C" typedef BOOL (WINAPI *t_EnumProcessModules)( HANDLE, HMODULE*, DWORD, LPDWORD );
|
||||
extern "C" typedef BOOL (WINAPI *t_GetModuleInformation)( HANDLE, HMODULE, LPMODULEINFO, DWORD );
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __TRACYSYSTRACE_HPP__
|
||||
#define __TRACYSYSTRACE_HPP__
|
||||
|
||||
#if !defined TRACY_NO_SYSTEM_TRACING && ( defined _WIN32 || defined __CYGWIN__ || defined __linux__ )
|
||||
#if !defined TRACY_NO_SYSTEM_TRACING && ( defined _WIN32 || defined __linux__ )
|
||||
# define TRACY_HAS_SYSTEM_TRACING
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __TRACYTHREAD_HPP__
|
||||
#define __TRACYTHREAD_HPP__
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <pthread.h>
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#if defined _WIN32 || defined __CYGWIN__
|
||||
#if defined _WIN32
|
||||
|
||||
class Thread
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user