mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 12:23:53 +00:00
Add thread group hint to ThreadNameData.
This commit is contained in:
parent
fb18a81d79
commit
3658c0c90f
@ -104,6 +104,7 @@ TRACY_API uint32_t GetThreadHandleImpl()
|
|||||||
struct ThreadNameData
|
struct ThreadNameData
|
||||||
{
|
{
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
|
uint32_t groupHint;
|
||||||
const char* name;
|
const char* name;
|
||||||
ThreadNameData* next;
|
ThreadNameData* next;
|
||||||
};
|
};
|
||||||
@ -134,6 +135,11 @@ void ThreadNameMsvcMagic( const THREADNAME_INFO& info )
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACY_API void SetThreadName( const char* name )
|
TRACY_API void SetThreadName( const char* name )
|
||||||
|
{
|
||||||
|
SetThreadNameWithHint( name, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
TRACY_API void SetThreadNameWithHint( const char* name, uint32_t groupHint )
|
||||||
{
|
{
|
||||||
#if defined _WIN32
|
#if defined _WIN32
|
||||||
# ifdef TRACY_UWP
|
# ifdef TRACY_UWP
|
||||||
@ -205,6 +211,7 @@ TRACY_API void SetThreadName( const char* name )
|
|||||||
buf[sz] = '\0';
|
buf[sz] = '\0';
|
||||||
auto data = (ThreadNameData*)tracy_malloc_fast( sizeof( ThreadNameData ) );
|
auto data = (ThreadNameData*)tracy_malloc_fast( sizeof( ThreadNameData ) );
|
||||||
data->id = detail::GetThreadHandleImpl();
|
data->id = detail::GetThreadHandleImpl();
|
||||||
|
data->groupHint = groupHint;
|
||||||
data->name = buf;
|
data->name = buf;
|
||||||
data->next = GetThreadNameData().load( std::memory_order_relaxed );
|
data->next = GetThreadNameData().load( std::memory_order_relaxed );
|
||||||
while( !GetThreadNameData().compare_exchange_weak( data->next, data, std::memory_order_release, std::memory_order_relaxed ) ) {}
|
while( !GetThreadNameData().compare_exchange_weak( data->next, data, std::memory_order_release, std::memory_order_relaxed ) ) {}
|
||||||
|
@ -23,6 +23,7 @@ static inline uint32_t GetThreadHandle()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACY_API void SetThreadName( const char* name );
|
TRACY_API void SetThreadName( const char* name );
|
||||||
|
TRACY_API void SetThreadNameWithHint( const char* name, uint32_t groupHint );
|
||||||
TRACY_API const char* GetThreadName( uint32_t id );
|
TRACY_API const char* GetThreadName( uint32_t id );
|
||||||
|
|
||||||
TRACY_API const char* GetEnvVar( const char* name );
|
TRACY_API const char* GetEnvVar( const char* name );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user