mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Initialize rpmalloc.
This commit is contained in:
parent
b75317be7d
commit
e8968efea7
@ -19,6 +19,7 @@
|
|||||||
#include "../common/TracyProtocol.hpp"
|
#include "../common/TracyProtocol.hpp"
|
||||||
#include "../common/TracySocket.hpp"
|
#include "../common/TracySocket.hpp"
|
||||||
#include "../common/TracySystem.hpp"
|
#include "../common/TracySystem.hpp"
|
||||||
|
#include "tracy_rpmalloc.hpp"
|
||||||
#include "TracyScoped.hpp"
|
#include "TracyScoped.hpp"
|
||||||
#include "TracyProfiler.hpp"
|
#include "TracyProfiler.hpp"
|
||||||
|
|
||||||
@ -35,6 +36,18 @@
|
|||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
|
struct RPMallocInit
|
||||||
|
{
|
||||||
|
RPMallocInit() { rpmalloc_initialize(); }
|
||||||
|
~RPMallocInit() { rpmalloc_finalize(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct RPMallocThreadInit
|
||||||
|
{
|
||||||
|
RPMallocThreadInit() { rpmalloc_thread_initialize(); }
|
||||||
|
~RPMallocThreadInit() { rpmalloc_thread_finalize(); }
|
||||||
|
};
|
||||||
|
|
||||||
static const char* GetProcessName()
|
static const char* GetProcessName()
|
||||||
{
|
{
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
@ -54,14 +67,16 @@ static const char* GetProcessName()
|
|||||||
|
|
||||||
enum { QueuePrealloc = 256 * 1024 };
|
enum { QueuePrealloc = 256 * 1024 };
|
||||||
|
|
||||||
static moodycamel::ConcurrentQueue<QueueItem> init_order(101) s_queue( QueueItemSize * QueuePrealloc );
|
static RPMallocInit init_order(101) s_rpmalloc_init;
|
||||||
static thread_local moodycamel::ProducerToken init_order(102) s_token_detail( s_queue );
|
static thread_local RPMallocThreadInit init_order(102) s_rpmalloc_thread_init;
|
||||||
thread_local ProducerWrapper init_order(103) s_token { s_queue.get_explicit_producer( s_token_detail ) };
|
static moodycamel::ConcurrentQueue<QueueItem> init_order(103) s_queue( QueueItemSize * QueuePrealloc );
|
||||||
|
static thread_local moodycamel::ProducerToken init_order(104) s_token_detail( s_queue );
|
||||||
|
thread_local ProducerWrapper init_order(105) s_token { s_queue.get_explicit_producer( s_token_detail ) };
|
||||||
|
|
||||||
std::atomic<uint64_t> s_id( 0 );
|
std::atomic<uint64_t> s_id( 0 );
|
||||||
|
|
||||||
#ifndef TRACY_DISABLE
|
#ifndef TRACY_DISABLE
|
||||||
static Profiler init_order(104) s_profiler;
|
static Profiler init_order(106) s_profiler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static Profiler* s_instance = nullptr;
|
static Profiler* s_instance = nullptr;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user