| 631 | } |
| 632 | |
| 633 | void 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 | |
| 659 | void ThreadStatus::initQueryProfiler() |
| 660 | { |
no test coverage detected