mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08: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(); }
|
RPMallocThreadInit() { rpmalloc_thread_initialize(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct InitTimeWrapper
|
||||||
|
{
|
||||||
|
int64_t val;
|
||||||
|
};
|
||||||
|
|
||||||
static const char* GetProcessName()
|
static const char* GetProcessName()
|
||||||
{
|
{
|
||||||
#if defined _MSC_VER
|
#if defined _MSC_VER
|
||||||
@ -73,15 +78,16 @@ enum { QueuePrealloc = 256 * 1024 };
|
|||||||
|
|
||||||
static Profiler* s_instance = nullptr;
|
static Profiler* s_instance = nullptr;
|
||||||
static Thread* s_thread = nullptr;
|
static Thread* s_thread = nullptr;
|
||||||
|
static unsigned int __dontcare_cpu;
|
||||||
|
|
||||||
// 1a. But s_queue is needed for initialization of variables in point 2.
|
// 1a. But s_queue is needed for initialization of variables in point 2.
|
||||||
extern moodycamel::ConcurrentQueue<QueueItem> s_queue;
|
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.
|
// 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 );
|
static thread_local moodycamel::ProducerToken init_order(106) s_token_detail( s_queue );
|
||||||
thread_local ProducerWrapper init_order(106) s_token { s_queue.get_explicit_producer( s_token_detail ) };
|
thread_local ProducerWrapper init_order(107) s_token { s_queue.get_explicit_producer( s_token_detail ) };
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
// 1. Initialize these static variables before all other variables.
|
// 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" )
|
# pragma init_seg( ".CRT$XCB" )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static RPMallocInit init_order(101) s_rpmalloc_init;
|
static InitTimeWrapper init_order(101) s_initTime { Profiler::GetTime( __dontcare_cpu ) };
|
||||||
moodycamel::ConcurrentQueue<QueueItem> init_order(102) s_queue( QueuePrealloc );
|
static RPMallocInit init_order(102) s_rpmalloc_init;
|
||||||
static Profiler init_order(103) s_profiler;
|
moodycamel::ConcurrentQueue<QueueItem> init_order(103) s_queue( QueuePrealloc );
|
||||||
|
static Profiler init_order(104) s_profiler;
|
||||||
|
|
||||||
|
|
||||||
Profiler::Profiler()
|
Profiler::Profiler()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user