2024-03-19 16:10:48 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
|
|
|
|
class Timer {
|
|
|
|
private:
|
|
|
|
std::chrono::time_point<std::chrono::high_resolution_clock> start_;
|
2024-03-20 08:58:40 +00:00
|
|
|
std::chrono::time_point<std::chrono::high_resolution_clock> end_;
|
2024-03-19 16:10:48 +00:00
|
|
|
|
|
|
|
public:
|
2024-03-20 08:58:40 +00:00
|
|
|
Timer();
|
2024-03-19 16:10:48 +00:00
|
|
|
|
|
|
|
void start();
|
|
|
|
void stop();
|
2024-03-20 08:58:40 +00:00
|
|
|
|
|
|
|
long us() const;
|
2024-03-19 16:10:48 +00:00
|
|
|
};
|
2024-03-20 09:13:08 +00:00
|
|
|
|
|
|
|
std::ostream &operator<<(std::ostream &os, const Timer &timer);
|