Stopwatch is a simple, fast, cross-platform and header-only stopwatch for C++.
sudo sh ./test.sh
./test
-
include header
#include "stopwatch.hpp"
-
instantiate a class in stack
Stopwatch stopwatch;
-
start stopwatch
stopwatch.start();
-
split and get duration
std::cout << "duration: " << stopwatch.split() << " seconds" << std::endl;
or
duration_t duration = stopwatch.split_raw(); std::cout << "duration: " << duration.count() << " seconds" << std::endl;
-
get current time
std::cout << "current_time: " << Stopwatch::now << std::endl;
-
get splits
std::cout << stopwatch.splits() << std::endl;
-
stop stopwatch
stopwatch.stop();