c76170a9db
Reviewers: teon.banek Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1359
21 lines
399 B
C++
21 lines
399 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
|
|
namespace utils {
|
|
|
|
// This class is threadsafe.
|
|
class Timer {
|
|
public:
|
|
/** Time elapsed since creation. */
|
|
std::chrono::duration<double> Elapsed() const {
|
|
return std::chrono::steady_clock::now() - start_time_;
|
|
}
|
|
|
|
private:
|
|
std::chrono::time_point<std::chrono::steady_clock> start_time_ =
|
|
std::chrono::steady_clock::now();
|
|
};
|
|
|
|
} // namespace utils
|