Commit dd6e6b68 authored by Dave Watson's avatar Dave Watson Committed by Facebook Github Bot 9

fix hhwheeltimertest

Summary:
Test doesn't match comments.  Remove extranous commented code.

I think there was actually a subtle bug in the test: since 25 doesn't evenly divide in to 6, we could end up farther away than we were expecting.  The same is true of 10/3, but it remains within the threshold.

Reviewed By: yfeldblum

Differential Revision: D3637078

fbshipit-source-id: d9881143c33c9b4f203f839e2e5106183301b530
parent 9095cd53
...@@ -259,8 +259,8 @@ TEST_F(HHWheelTimerTest, AtMostEveryN) { ...@@ -259,8 +259,8 @@ TEST_F(HHWheelTimerTest, AtMostEveryN) {
// Create a timeout set with a 10ms interval, to fire no more than once // Create a timeout set with a 10ms interval, to fire no more than once
// every 3ms. // every 3ms.
milliseconds interval(25); milliseconds interval(10);
milliseconds atMostEveryN(6); milliseconds atMostEveryN(3);
StackWheelTimer t(&eventBase, atMostEveryN); StackWheelTimer t(&eventBase, atMostEveryN);
t.setCatchupEveryN(70); t.setCatchupEveryN(70);
...@@ -294,14 +294,11 @@ TEST_F(HHWheelTimerTest, AtMostEveryN) { ...@@ -294,14 +294,11 @@ TEST_F(HHWheelTimerTest, AtMostEveryN) {
++index; ++index;
}; };
// Go ahead and schedule the first timeout now.
//scheduler.fn();
TimePoint start; TimePoint start;
eventBase.loop(); eventBase.loop();
TimePoint end; TimePoint end;
// This should take roughly 2*60 + 25 ms to finish. If it takes more than // This should take roughly 60 + 10 ms to finish. If it takes more than
// 250 ms to finish the system is probably heavily loaded, so skip. // 250 ms to finish the system is probably heavily loaded, so skip.
if (std::chrono::duration_cast<std::chrono::milliseconds>( if (std::chrono::duration_cast<std::chrono::milliseconds>(
end.getTime() - start.getTime()).count() > 250) { end.getTime() - start.getTime()).count() > 250) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment