From 826affb0b557474eba3335dc2a21668ea3c0f136 Mon Sep 17 00:00:00 2001 From: Niclas Olmenius Date: Mon, 3 Aug 2020 17:31:00 +0200 Subject: [PATCH] add set thread to c api --- TracyC.h | 4 ++++ common/TracySystem.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/TracyC.h b/TracyC.h index e97cd0b9..7ac1d69a 100644 --- a/TracyC.h +++ b/TracyC.h @@ -168,6 +168,10 @@ TRACY_API void ___tracy_emit_message_appinfo( const char* txt, size_t size ); #define TracyCPlot( name, val ) ___tracy_emit_plot( name, val ); #define TracyCAppInfo( txt, color ) ___tracy_emit_message_appinfo( txt, color ); +TRACY_API void ___tracy_set_thread_name( const char* name ); + +#define TracyCSetThreadName( name ) ___tracy_set_thread_name( name ); + #ifdef TRACY_HAS_CALLSTACK # define TracyCZoneS( ctx, depth, active ) static const struct ___tracy_source_location_data TracyConcat(__tracy_source_location,__LINE__) = { NULL, __FUNCTION__, __FILE__, (uint32_t)__LINE__, 0 }; TracyCZoneCtx ctx = ___tracy_emit_zone_begin_callstack( &TracyConcat(__tracy_source_location,__LINE__), depth, active ); diff --git a/common/TracySystem.cpp b/common/TracySystem.cpp index 25ccf9f8..18b39dac 100644 --- a/common/TracySystem.cpp +++ b/common/TracySystem.cpp @@ -237,3 +237,13 @@ TRACY_API const char* GetThreadName( uint64_t id ) } } + +#ifdef __cplusplus +extern "C" { +#endif + +TRACY_API void ___tracy_set_thread_name( const char* name ) { tracy::SetThreadName( name ); } + +#ifdef __cplusplus +} +#endif