1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Merge remote-tracking branch 'origin/master' into hw

This commit is contained in:
Bartosz Taudul
2021-06-02 01:12:28 +02:00
21 changed files with 112 additions and 104 deletions
+15
View File
@@ -4,15 +4,28 @@
#include <stdlib.h>
#ifdef TRACY_ENABLE
# include "TracyApi.h"
# include "TracyForceInline.hpp"
# include "../client/tracy_rpmalloc.hpp"
#endif
namespace tracy
{
#ifdef TRACY_ENABLE
extern thread_local bool RpThreadInitDone;
TRACY_API void InitRpmallocPlumbing();
static tracy_force_inline void InitRpmalloc()
{
if( !RpThreadInitDone ) InitRpmallocPlumbing();
}
#endif
static inline void* tracy_malloc( size_t size )
{
#ifdef TRACY_ENABLE
InitRpmalloc();
return rpmalloc( size );
#else
return malloc( size );
@@ -22,6 +35,7 @@ static inline void* tracy_malloc( size_t size )
static inline void tracy_free( void* ptr )
{
#ifdef TRACY_ENABLE
InitRpmalloc();
rpfree( ptr );
#else
free( ptr );
@@ -31,6 +45,7 @@ static inline void tracy_free( void* ptr )
static inline void* tracy_realloc( void* ptr, size_t size )
{
#ifdef TRACY_ENABLE
InitRpmalloc();
return rprealloc( ptr, size );
#else
return realloc( ptr, size );
-2
View File
@@ -96,7 +96,6 @@ struct ThreadNameData
ThreadNameData* next;
};
std::atomic<ThreadNameData*>& GetThreadNameData();
TRACY_API void InitRPMallocThread();
#endif
#ifdef _MSC_VER
@@ -161,7 +160,6 @@ TRACY_API void SetThreadName( const char* name )
#endif
#ifdef TRACY_ENABLE
{
InitRPMallocThread();
const auto sz = strlen( name );
char* buf = (char*)tracy_malloc( sz+1 );
memcpy( buf, name, sz );
+26
View File
@@ -0,0 +1,26 @@
#ifndef __TRACYYIELD_HPP__
#define __TRACYYIELD_HPP__
#if defined __SSE2__ || defined _M_AMD64 || _M_IX86_FP == 2
# include <emmintrin.h>
#else
# include <thread>
#endif
#include "TracyForceInline.hpp"
namespace tracy
{
static tracy_force_inline void YieldThread()
{
#if defined __SSE2__ || defined _M_AMD64 || _M_IX86_FP == 2
_mm_pause();
#else
std::this_thread::yield();
#endif
}
}
#endif