diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-16 16:32:14 -0800 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-02-16 16:32:36 -0800 |
| commit | e16084cc8d15b0c042871b0d1cffa6320a1681d4 (patch) | |
| tree | a06678cd3da99fca13374bebe6e73c36bce1245f /toolsrc/include/Stopwatch.h | |
| parent | a62558fb793a0c8e31c189f8f5eebe3fc5c83f58 (diff) | |
| download | vcpkg-e16084cc8d15b0c042871b0d1cffa6320a1681d4.tar.gz vcpkg-e16084cc8d15b0c042871b0d1cffa6320a1681d4.zip | |
Rename Stopwatch.h/cpp to vcpkg_Chrono.h/cpp
Diffstat (limited to 'toolsrc/include/Stopwatch.h')
| -rw-r--r-- | toolsrc/include/Stopwatch.h | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h deleted file mode 100644 index e4ae121b3..000000000 --- a/toolsrc/include/Stopwatch.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once - -#include <chrono> -#include <string> - -namespace vcpkg -{ - class ElapsedTime - { - public: - static ElapsedTime createStarted(); - - constexpr ElapsedTime() :m_startTick() {} - - template <class TimeUnit> - TimeUnit elapsed() const - { - return std::chrono::duration_cast<TimeUnit>(std::chrono::high_resolution_clock::now() - this->m_startTick); - } - - std::string toString() const; - - private: - std::chrono::steady_clock::time_point m_startTick; - }; - - class Stopwatch - { - public: - static Stopwatch createUnstarted(); - - static Stopwatch createStarted(); - - bool isRunning() const; - - const Stopwatch& start(); - - const Stopwatch& stop(); - - Stopwatch& reset(); - - template <class TimeUnit> - TimeUnit elapsed() const - { - return std::chrono::duration_cast<TimeUnit>(elapsedNanos()); - } - - std::string toString() const; - - private: - Stopwatch(); - - std::chrono::nanoseconds elapsedNanos() const; - - bool m_isRunning; - std::chrono::nanoseconds m_elapsedNanos; - std::chrono::steady_clock::time_point m_startTick; - }; -} |
