aboutsummaryrefslogtreecommitdiff
path: root/toolsrc/include
diff options
context:
space:
mode:
Diffstat (limited to 'toolsrc/include')
-rw-r--r--toolsrc/include/Stopwatch.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/toolsrc/include/Stopwatch.h b/toolsrc/include/Stopwatch.h
index 105a4b1ee..e4ae121b3 100644
--- a/toolsrc/include/Stopwatch.h
+++ b/toolsrc/include/Stopwatch.h
@@ -5,6 +5,25 @@
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: