CatapultServer  v0.5.0.1 (Elephant)
StackTimer.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include <chrono>
23 
24 namespace catapult { namespace utils {
25 
27  class StackTimer {
28  private:
29  using Clock = std::chrono::steady_clock;
30 
31  public:
33  StackTimer() : m_start(Clock::now())
34  {}
35 
36  public:
38  uint64_t millis() const {
39  auto elapsedDuration = Clock::now() - m_start;
40  return static_cast<uint64_t>(std::chrono::duration_cast<std::chrono::milliseconds>(elapsedDuration).count());
41  }
42 
43  private:
44  Clock::time_point m_start;
45  };
46 }}
catapult::utils::StackTimer::m_start
Clock::time_point m_start
Definition: StackTimer.h:44
catapult::utils::StackTimer::StackTimer
StackTimer()
Constructs a stack timer.
Definition: StackTimer.h:33
catapult::utils::StackTimer
Stack based timer.
Definition: StackTimer.h:27
catapult::utils::StackTimer::Clock
std::chrono::steady_clock Clock
Definition: StackTimer.h:29
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::utils::StackTimer::millis
uint64_t millis() const
Gets the number of elapsed milliseconds since this logger was created.
Definition: StackTimer.h:38