Stop contention profiler.
| 353 | |
| 354 | // Stop contention profiler. |
| 355 | void ContentionProfilerStop() { |
| 356 | ContentionProfiler* ctx = NULL; |
| 357 | if (g_cp) { |
| 358 | std::unique_lock<pthread_mutex_t> mu(g_cp_mutex); |
| 359 | if (g_cp) { |
| 360 | ctx = g_cp; |
| 361 | g_cp = NULL; |
| 362 | mu.unlock(); |
| 363 | |
| 364 | // make sure it's initialiazed in case no sample was gathered, |
| 365 | // otherwise nothing will be written and succeeding pprof will fail. |
| 366 | ctx->init_if_needed(); |
| 367 | // Deletion is safe because usages of g_cp are inside g_cp_mutex. |
| 368 | delete ctx; |
| 369 | return; |
| 370 | } |
| 371 | } |
| 372 | LOG(ERROR) << "Contention profiler is not started!"; |
| 373 | } |
| 374 | |
| 375 | bool is_contention_site_valid(const bthread_contention_site_t& cs) { |
| 376 | return bvar::is_sampling_range_valid(cs.sampling_range); |
no test coverage detected