diff options
author | Yu Jin Kang Park <yujin.kang@mongodb.com> | 2022-07-27 08:01:23 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-27 08:45:34 +0000 |
commit | bf52572c404f82af8f71665f0266beb3cdbff69a (patch) | |
tree | 067916fcd85bf1f552a61694e4a0af75e8637723 /src | |
parent | fddc60968b4e9b533e5709de1bb151c0353c0301 (diff) | |
download | mongo-bf52572c404f82af8f71665f0266beb3cdbff69a.tar.gz |
SERVER-68304: Remove TestTimerElapsedAfterMultipleDetachAttach
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/operation_cpu_timer_test.cpp | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/src/mongo/db/operation_cpu_timer_test.cpp b/src/mongo/db/operation_cpu_timer_test.cpp index 04c0e0b97df..78561479c51 100644 --- a/src/mongo/db/operation_cpu_timer_test.cpp +++ b/src/mongo/db/operation_cpu_timer_test.cpp @@ -127,55 +127,6 @@ TEST_F(OperationCPUTimerTest, TestTimerDetachAndAttachHandlers) { observer.join(); } -TEST_F(OperationCPUTimerTest, TestTimerElapsedAfterMultipleDetachAttach) { - - auto checkTimerAccumulatesElapsedTime = [&]() { - auto timer = getTimer(); - timer->start(); - busyWait(Microseconds(100)); // Elapse 100 us. - timer->onThreadDetach(); - - busyWait(Microseconds(100)); - - timer->onThreadAttach(); - busyWait(Microseconds(10)); // Elapse 10 us. - timer->onThreadDetach(); - - busyWait(Microseconds(100)); - - timer->onThreadAttach(); - busyWait(Microseconds(10)); // Elapse 10 us. - timer->stop(); - - return timer->getElapsed(); - }; - - // PosixTimer relies on clock_gettime, which might give bad results if the thread is migrated to - // another CPU when using a GLIBC < 2.4. Additionally, even on systems with GLIBC >= 2.4 - // reported time can occasionally be incorrect due to precision issues. E.g. 119999000 ns < 120 - // ms. - - // We try to work around this issue by executing the test multiple times and establishing a - // threshold failure rate. This does not guarantee that the test will not fail, but should - // reduce the amount of noise. - - const auto kRepeats = 1000; - const auto kMaxFailureRate = 0.1; - const auto kMaxFailures = kMaxFailureRate * kRepeats; - auto nFailures = 0; - auto nRetries = 0; - while (nRetries++ < kRepeats) { - auto testResult = checkTimerAccumulatesElapsedTime(); - // Total elapsed while attached should be GTE 120 us. - if (testResult < Microseconds(120)) { - ++nFailures; - } - // Verifies we do not compute detached time. - ASSERT_LT(testResult, Microseconds(200)); - } - ASSERT_LTE(nFailures, kMaxFailures); -} - DEATH_TEST_F(OperationCPUTimerTest, AccessTimerForDetachedOperation, "Operation not attached to the current thread") { |