From e00767134f649efb8f48e5cc10b5429152fd8317 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sun, 1 Mar 2020 19:07:51 +0300 Subject: [PATCH] Chaos sanitizer: development --- dbms/src/Common/tests/chaos_sanitizer.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/dbms/src/Common/tests/chaos_sanitizer.cpp b/dbms/src/Common/tests/chaos_sanitizer.cpp index 18733aa5491..3e23fc3cc4c 100644 --- a/dbms/src/Common/tests/chaos_sanitizer.cpp +++ b/dbms/src/Common/tests/chaos_sanitizer.cpp @@ -109,16 +109,8 @@ private: static constexpr UInt32 TIMER_PRECISION = 1e6; - /// Randomize offset as uniform random value from 0 to period - 1. - /// It will allow to sample short queries even if timer period is large. - /// (For example, with period of 1 second, query with 50 ms duration will be sampled with 1 / 20 probability). - /// It also helps to avoid interference (moire). - UInt32 period_rand = std::uniform_int_distribution(0, cpu_time_period_us)(thread_local_rng); - struct timeval interval{.tv_sec = long(cpu_time_period_us / TIMER_PRECISION), .tv_usec = long(cpu_time_period_us % TIMER_PRECISION)}; - struct timeval offset{.tv_sec = period_rand / TIMER_PRECISION, .tv_usec = period_rand % TIMER_PRECISION}; - - struct itimerval timer = {.it_interval = interval, .it_value = offset}; + struct itimerval timer = {.it_interval = interval, .it_value = {0, 0}}; if (0 != setitimer(ITIMER_PROF, &timer, nullptr)) throwFromErrno("Failed to create profiling timer", ErrorCodes::CANNOT_CREATE_TIMER);