[llvm] r256308 - Unbreak LLVM_ENABLE_THREADS=OFF builds.

Vedant Kumar via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 22 17:20:29 PST 2015


Thanks!

> On Dec 22, 2015, at 5:04 PM, Nico Weber via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> Author: nico
> Date: Tue Dec 22 19:04:53 2015
> New Revision: 256308
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=256308&view=rev
> Log:
> Unbreak LLVM_ENABLE_THREADS=OFF builds.
> 
> Modified:
>    llvm/trunk/unittests/Support/TimerTest.cpp
> 
> Modified: llvm/trunk/unittests/Support/TimerTest.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/TimerTest.cpp?rev=256308&r1=256307&r2=256308&view=diff
> ==============================================================================
> --- llvm/trunk/unittests/Support/TimerTest.cpp (original)
> +++ llvm/trunk/unittests/Support/TimerTest.cpp Tue Dec 22 19:04:53 2015
> @@ -8,14 +8,30 @@
> //===----------------------------------------------------------------------===//
> 
> #include "llvm/Support/Timer.h"
> -#include "llvm/Support/thread.h"
> #include "gtest/gtest.h"
> -#include <chrono>
> +
> +#if LLVM_ON_WIN32
> +#include <windows.h>
> +#else
> +#include <time.h>
> +#endif
> 
> using namespace llvm;
> 
> namespace {
> 
> +// FIXME: Put this somewhere in Support, it's also used in LockFileManager.
> +void SleepMS() {
> +#if LLVM_ON_WIN32
> +  Sleep(1);
> +#else
> +  struct timespec Interval;
> +  Interval.tv_sec = 0;
> +  Interval.tv_nsec = 1000000;
> +  nanosleep(&Interval, nullptr);
> +#endif
> +}
> +
> TEST(Timer, Additivity) {
>   Timer T1("T1");
> 
> @@ -26,7 +42,7 @@ TEST(Timer, Additivity) {
>   auto TR1 = T1.getTotalTime();
> 
>   T1.startTimer();
> -  std::this_thread::sleep_for(std::chrono::milliseconds(1));
> +  SleepMS();
>   T1.stopTimer();
>   auto TR2 = T1.getTotalTime();
> 
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list