diff options
Diffstat (limited to 'Source/WTF/wtf/CurrentTime.h')
-rw-r--r-- | Source/WTF/wtf/CurrentTime.h | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/WTF/wtf/CurrentTime.h b/Source/WTF/wtf/CurrentTime.h index 78e58017f..74b236f79 100644 --- a/Source/WTF/wtf/CurrentTime.h +++ b/Source/WTF/wtf/CurrentTime.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2006 Apple Inc. All rights reserved. * Copyright (C) 2008 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,6 +32,7 @@ #ifndef CurrentTime_h #define CurrentTime_h +#include <chrono> #include <time.h> namespace WTF { @@ -55,19 +56,31 @@ inline double currentTimeMS() // NTP or manual adjustments, so it is better suited for elapsed time measurement. WTF_EXPORT_PRIVATE double monotonicallyIncreasingTime(); -// Returns the current CPU time of the current thread in seconds. +inline double monotonicallyIncreasingTimeMS() +{ + return monotonicallyIncreasingTime() * 1000.0; +} + +// Returns the current CPU time of the current thread. // Precision varies depending on platform but is usually as good or better // than a millisecond. -WTF_EXPORT_PRIVATE double currentCPUTime(); +WTF_EXPORT_PRIVATE std::chrono::microseconds currentCPUTime(); + +WTF_EXPORT_PRIVATE void sleep(double); -// Returns the current CPU time of the current thread in milliseconds. -WTF_EXPORT_PRIVATE double currentCPUTimeMS(); +inline void sleepMS(double value) +{ + sleep(value / 1000.0); +} } // namespace WTF +using WTF::currentCPUTime; using WTF::currentTime; using WTF::currentTimeMS; using WTF::monotonicallyIncreasingTime; -using WTF::currentCPUTime; +using WTF::monotonicallyIncreasingTimeMS; +using WTF::sleep; +using WTF::sleepMS; #endif // CurrentTime_h |