diff options
Diffstat (limited to 'lib/Support/Timer.cpp')
-rw-r--r-- | lib/Support/Timer.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Support/Timer.cpp b/lib/Support/Timer.cpp index da969810..0e727bb4 100644 --- a/lib/Support/Timer.cpp +++ b/lib/Support/Timer.cpp @@ -15,6 +15,20 @@ using namespace klee; using namespace llvm; +#if LLVM_VERSION_CODE >= LLVM_VERSION(4, 0) + +WallTimer::WallTimer() { + start = util::getWallTimeVal(); +} + +uint64_t WallTimer::check() { + auto now = util::getWallTimeVal(); + return std::chrono::duration_cast<std::chrono::microseconds>(now - + start).count(); +} + +#else + WallTimer::WallTimer() { startMicroseconds = util::getWallTimeVal().usec(); } @@ -22,3 +36,5 @@ WallTimer::WallTimer() { uint64_t WallTimer::check() { return util::getWallTimeVal().usec() - startMicroseconds; } + +#endif |