CPP-TOOLBOX
Loading...
Searching...
No Matches
stopwatch.hpp
Go to the documentation of this file.
1#ifndef STOPWATCH_HPP
2#define STOPWATCH_HPP
3
4#include <chrono>
11class Stopwatch {
12 public:
13 void press();
14 double average_frequency = 0.0;
15
16 private:
17 double compute_average_period();
18 int num_times_to_average_over = 10;
19 double times[10] = {0};
20 bool first_time = true;
21 int curr_idx = 0;
22 std::chrono::time_point<std::chrono::system_clock> previous_time;
23};
24
25#endif
A stopwatch which measures how frequently it's been pressed in seconds to be used to measure at what ...
Definition stopwatch.hpp:11
void press()
Definition stopwatch.cpp:3
double average_frequency
Definition stopwatch.hpp:14