Skip to content

Commit

Permalink
Bug 1546012 - Avoid slow sleeps on Android in TestSPSCQueue; r=padenot
Browse files Browse the repository at this point in the history
Reducing the sleep to 0 on Android results in a dramatic reduction in run time, and the test
passes consistently.

Differential Revision: https://phabricator.services.mozilla.com/D28296

--HG--
extra : moz-landing-system : lando
  • Loading branch information
gbrownmozilla committed Apr 23, 2019
1 parent 2751447 commit 323e21a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mfbt/tests/TestSPSCQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ void TestRing(int capacity) {
}

void Delay() {
// On Windows, the timer resolution is so bad that, even if we used
// `timeBeginPeriod(1)`, any nonzero sleep from the test's inner loops
// On Windows and x86 Android, the timer resolution is so bad that, even if
// we used `timeBeginPeriod(1)`, any nonzero sleep from the test's inner loops
// would make this program take far too long.
#ifdef _WIN32
Sleep(0);
#elif defined(ANDROID)
std::this_thread::sleep_for(std::chrono::microseconds(0));
#else
std::this_thread::sleep_for(std::chrono::microseconds(10));
#endif
Expand Down

0 comments on commit 323e21a

Please sign in to comment.