MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / initGlobalProfiler

Method initGlobalProfiler

src/Interpreters/ThreadStatusExt.cpp:633–657  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

631}
632
633void ThreadStatus::initGlobalProfiler([[maybe_unused]] UInt64 global_profiler_real_time_period, [[maybe_unused]] UInt64 global_profiler_cpu_time_period)
634{
635#if defined(SIGEV_THREAD_ID)
636 /// profilers are useless without trace collector
637 auto context = Context::getGlobalContextInstance();
638 if (!context->hasTraceCollector())
639 return;
640
641 try
642 {
643 if (global_profiler_real_time_period > 0)
644 query_profiler_real = std::make_unique<QueryProfilerReal>(thread_id,
645 /* period= */ global_profiler_real_time_period);
646
647 if (global_profiler_cpu_time_period > 0)
648 query_profiler_cpu = std::make_unique<QueryProfilerCPU>(thread_id,
649 /* period= */ global_profiler_cpu_time_period);
650 }
651 catch (...)
652 {
653 /// GlobalProfiler is optional.
654 tryLogCurrentException(LogFrequencyLimiter(log, 10), "Cannot initialize GlobalProfiler. This usually happens when RLIMIT_SIGPENDING is too low. You may tune it via pending_signals in config.", LogsLevel::warning);
655 }
656#endif
657}
658
659void ThreadStatus::initQueryProfiler()
660{

Callers 2

runMethod · 0.80

Calls 2

tryLogCurrentExceptionFunction · 0.50
hasTraceCollectorMethod · 0.45

Tested by

no test coverage detected