16 template <
typename Time = std::chrono::microseconds,
typename Clock = std::chrono::high_resolution_clock>
19 mutable std::mutex mtx;
20 typename Clock::time_point start_time;
21 typename Clock::time_point end_time;
24 explicit progress() : start_time(Clock::now()), end_time(start_time) {}
33 template <
typename F,
typename... Args,
typename Duration = Time>
39 auto result = std::invoke(std::forward<F>(f), std::forward<Args>(
args)...);
43 return Duration::zero();
53 std::lock_guard<std::mutex> lock(this->mtx);
54 start_time = end_time = Clock::now();
66 template <
typename T =
double>
69 std::lock_guard<std::mutex> lock(this->mtx);
70 end_time = Clock::now();
71 return static_cast<T
>(std::chrono::duration_cast<Time>(end_time - start_time).count());
Command-line argument handler with JSON support.
Definition args.h:20
Simple clock for elapsed events.
Definition progress.h:18
void start() noexcept
Start the progress.
Definition progress.h:51
static Duration duration(F &&f, Args &&...args)
Definition progress.h:34
T elapsed() noexcept
Capture the elapsed time.
Definition progress.h:67
void reset() noexcept
Reset the progress.
Definition progress.h:58
Namespace for the maze builder.
Definition algo_interface.h:6