summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
97cdf9d)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@256308
91177308-0d34-0410-b5e6-
96231b3b80d8
//===----------------------------------------------------------------------===//
#include "llvm/Support/Timer.h"
//===----------------------------------------------------------------------===//
#include "llvm/Support/Timer.h"
-#include "llvm/Support/thread.h"
+
+#if LLVM_ON_WIN32
+#include <windows.h>
+#else
+#include <time.h>
+#endif
using namespace llvm;
namespace {
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");
TEST(Timer, Additivity) {
Timer T1("T1");
auto TR1 = T1.getTotalTime();
T1.startTimer();
auto TR1 = T1.getTotalTime();
T1.startTimer();
- std::this_thread::sleep_for(std::chrono::milliseconds(1));
T1.stopTimer();
auto TR2 = T1.getTotalTime();
T1.stopTimer();
auto TR2 = T1.getTotalTime();