mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-10 02:31:48 +00:00
Measure time of initialization start.
This commit is contained in:
parent
866081bf29
commit
0ed789825a
@ -50,6 +50,11 @@ struct RPMallocThreadInit
|
||||
RPMallocThreadInit() { rpmalloc_thread_initialize(); }
|
||||
};
|
||||
|
||||
struct InitTimeWrapper
|
||||
{
|
||||
int64_t val;
|
||||
};
|
||||
|
||||
static const char* GetProcessName()
|
||||
{
|
||||
#if defined _MSC_VER
|
||||
@ -73,15 +78,16 @@ enum { QueuePrealloc = 256 * 1024 };
|
||||
|
||||
static Profiler* s_instance = nullptr;
|
||||
static Thread* s_thread = nullptr;
|
||||
static unsigned int __dontcare_cpu;
|
||||
|
||||
// 1a. But s_queue is needed for initialization of variables in point 2.
|
||||
extern moodycamel::ConcurrentQueue<QueueItem> s_queue;
|
||||
|
||||
static thread_local RPMallocThreadInit init_order(104) s_rpmalloc_thread_init;
|
||||
static thread_local RPMallocThreadInit init_order(105) s_rpmalloc_thread_init;
|
||||
|
||||
// 2. If these variables would be in the .CRT$XCB section, they would be initialized only in main thread.
|
||||
static thread_local moodycamel::ProducerToken init_order(105) s_token_detail( s_queue );
|
||||
thread_local ProducerWrapper init_order(106) s_token { s_queue.get_explicit_producer( s_token_detail ) };
|
||||
static thread_local moodycamel::ProducerToken init_order(106) s_token_detail( s_queue );
|
||||
thread_local ProducerWrapper init_order(107) s_token { s_queue.get_explicit_producer( s_token_detail ) };
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// 1. Initialize these static variables before all other variables.
|
||||
@ -89,9 +95,10 @@ thread_local ProducerWrapper init_order(106) s_token { s_queue.get_explicit_prod
|
||||
# pragma init_seg( ".CRT$XCB" )
|
||||
#endif
|
||||
|
||||
static RPMallocInit init_order(101) s_rpmalloc_init;
|
||||
moodycamel::ConcurrentQueue<QueueItem> init_order(102) s_queue( QueuePrealloc );
|
||||
static Profiler init_order(103) s_profiler;
|
||||
static InitTimeWrapper init_order(101) s_initTime { Profiler::GetTime( __dontcare_cpu ) };
|
||||
static RPMallocInit init_order(102) s_rpmalloc_init;
|
||||
moodycamel::ConcurrentQueue<QueueItem> init_order(103) s_queue( QueuePrealloc );
|
||||
static Profiler init_order(104) s_profiler;
|
||||
|
||||
|
||||
Profiler::Profiler()
|
||||
|
Loading…
Reference in New Issue
Block a user