mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Process name getter.
This commit is contained in:
parent
b1aa16763b
commit
6485457518
@ -1,9 +1,14 @@
|
||||
#ifdef _MSC_VER
|
||||
# include <winsock2.h>
|
||||
# include <windows.h>
|
||||
#else
|
||||
# include <sys/time.h>
|
||||
#endif
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
# include <errno.h>
|
||||
#endif
|
||||
|
||||
#include <atomic>
|
||||
#include <assert.h>
|
||||
#include <chrono>
|
||||
@ -24,6 +29,23 @@
|
||||
namespace tracy
|
||||
{
|
||||
|
||||
static const char* GetProcessName()
|
||||
{
|
||||
#if defined _MSC_VER || defined __CYGWIN__
|
||||
static char buf[_MAX_PATH];
|
||||
GetModuleFileNameA( nullptr, buf, _MAX_PATH );
|
||||
const char* ptr = buf;
|
||||
while( *ptr != '\0' ) ptr++;
|
||||
while( ptr > buf && *ptr != '\\' && *ptr != '/' ) ptr--;
|
||||
if( ptr > buf ) ptr++;
|
||||
return ptr;
|
||||
#elif defined _GNU_SOURCE
|
||||
return program_invocation_short_name;
|
||||
#else
|
||||
return "unknown";
|
||||
#endif
|
||||
}
|
||||
|
||||
enum { QueuePrealloc = 256 * 1024 };
|
||||
|
||||
moodycamel::ConcurrentQueue<QueueItem> s_queue( QueueItemSize * QueuePrealloc );
|
||||
|
Loading…
Reference in New Issue
Block a user