From 4ec94c97879aafef15f7663135745e4ba61e62cf Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Mon, 17 May 2021 00:15:33 +0200 Subject: Extract first public LiterateLB version --- tangle/util/timer.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 tangle/util/timer.h (limited to 'tangle/util/timer.h') diff --git a/tangle/util/timer.h b/tangle/util/timer.h new file mode 100644 index 0000000..fd5d832 --- /dev/null +++ b/tangle/util/timer.h @@ -0,0 +1,19 @@ +#pragma once +#include + +namespace timer { + +std::chrono::time_point now() { + return std::chrono::steady_clock::now(); +} + +double secondsSince( + std::chrono::time_point& pit) { + return std::chrono::duration_cast>(now() - pit).count(); +} + +double mlups(std::size_t nCells, std::size_t nSteps, std::chrono::time_point& start) { + return nCells * nSteps / (secondsSince(start) * 1e6); +} + +} -- cgit v1.2.3