From f02952d72a6a8bb4db00bd26a5a77872baaf4772 Mon Sep 17 00:00:00 2001 From: surtur Date: Tue, 7 Dec 2021 15:55:29 +0100 Subject: [PATCH] fortuna(random_data): add basic time tracking --- fortuna.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fortuna.cpp b/fortuna.cpp index 7068ccb..d6a4611 100644 --- a/fortuna.cpp +++ b/fortuna.cpp @@ -10,6 +10,9 @@ #include #include #include +#include + +#include namespace fortuna { @@ -23,12 +26,19 @@ namespace fortuna { Fortuna::~Fortuna() = default; auto Fortuna::random_data(unsigned int n_bytes) -> void { + const auto start{std::chrono::system_clock::now()}; + fmt::print("random_data starting - {}\n", start); incr_reseed_ctr(); std::string n{R.Gen.generate_random_data(n_bytes)}; fmt::print("got you {} proper bytes from generate_random_data -> {}\n", n_bytes, n); n.erase(); + + const auto end{std::chrono::system_clock::now()}; + std::chrono::duration diff = end-start; + fmt::print("random_data done - {}\n", end); + fmt::print("getting random data took {:.{}f}s\n", diff.count(), 12); } //random_data } // namespace fortuna