mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-25 00:58:30 -05:00
Updated Remotery.
This commit is contained in:
parent
c3dd88767a
commit
e19cd3bdf1
2 changed files with 19 additions and 1 deletions
15
3rdparty/remotery/lib/Remotery.c
vendored
15
3rdparty/remotery/lib/Remotery.c
vendored
|
@ -106,6 +106,7 @@ static rmtBool g_SettingsInitialized = RMT_FALSE;
|
|||
|
||||
#ifdef RMT_PLATFORM_LINUX
|
||||
#include <time.h>
|
||||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#if defined(RMT_PLATFORM_POSIX)
|
||||
|
@ -3664,10 +3665,14 @@ static rmtError ThreadSampler_Constructor(ThreadSampler* thread_sampler)
|
|||
thread_sampler->sample_trees[i] = NULL;
|
||||
thread_sampler->next = NULL;
|
||||
|
||||
// Set the initial name to Thread0 etc.
|
||||
// Set the initial name to Thread0 etc. or use the existing Linux name.
|
||||
thread_sampler->name[0] = 0;
|
||||
#if defined(RMT_PLATFORM_LINUX) && RMT_USE_POSIX_THREADNAMES
|
||||
prctl(PR_GET_NAME,thread_sampler->name,0,0,0);
|
||||
#else
|
||||
strncat_s(thread_sampler->name, sizeof(thread_sampler->name), "Thread", 6);
|
||||
itoahex_s(thread_sampler->name + 6, sizeof(thread_sampler->name) - 6, AtomicAdd(&countThreads, 1));
|
||||
#endif
|
||||
|
||||
// Create the CPU sample tree only - the rest are created on-demand as they need
|
||||
// extra context information to function correctly.
|
||||
|
@ -4369,6 +4374,14 @@ static void SetDebuggerThreadName(const char* name)
|
|||
#else
|
||||
RMT_UNREFERENCED_PARAMETER(name);
|
||||
#endif
|
||||
|
||||
#ifdef RMT_PLATFORM_LINUX
|
||||
// pthread_setname_np is a non-standard GNU extension.
|
||||
char name_clamp[16];
|
||||
name_clamp[0] = 0;
|
||||
strncat_s(name_clamp, sizeof(name_clamp), name, 15);
|
||||
prctl(PR_SET_NAME,name_clamp,0,0,0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
5
3rdparty/remotery/lib/Remotery.h
vendored
5
3rdparty/remotery/lib/Remotery.h
vendored
|
@ -67,6 +67,11 @@ documented just below this comment.
|
|||
#define RMT_USE_OPENGL 0
|
||||
#endif
|
||||
|
||||
// Initially use POSIX thread names to name threads instead of Thread0, 1, ...
|
||||
#ifndef RMT_USE_POSIX_THREADNAMES
|
||||
#define RMT_USE_POSIX_THREADNAMES 0
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in a new issue