diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WTF/wtf/CurrentTime.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
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 |