From 6e203ca9553902d94c4898aaca98182c965a533c Mon Sep 17 00:00:00 2001 From: Eric-Butcher Date: Sun, 1 Jun 2025 18:55:49 -0400 Subject: [PATCH 1/2] Added the warmup function --- include/program_runner.hpp | 4 ++++ src/runner.cpp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/include/program_runner.hpp b/include/program_runner.hpp index cec8223..0610b02 100644 --- a/include/program_runner.hpp +++ b/include/program_runner.hpp @@ -27,9 +27,13 @@ class ProgramRunner { bool is_finished(); + void warmup(uint64_t iterations = 1000); + const std::string version = "0.1"; const std::string program_name = "randomizer"; + + private: diff --git a/src/runner.cpp b/src/runner.cpp index 6541a04..f99b960 100644 --- a/src/runner.cpp +++ b/src/runner.cpp @@ -353,4 +353,10 @@ ProgramRunner::ProgramStatus ProgramRunner::run() { throw std::runtime_error("ProgramRunner has finished without returning an exit code. This should not happen."); } +void ProgramRunner::warmup(uint64_t iterations) { + for (uint64_t i = 0; i < iterations; ++i) { + this->prng->generateRandomValue(); // Warmup the PRNG + } +} + From 7eda7de9c9fe1225a4abc5353d559064b11796e7 Mon Sep 17 00:00:00 2001 From: Eric-Butcher Date: Sun, 1 Jun 2025 18:56:30 -0400 Subject: [PATCH 2/2] Added the call to warmup in main --- src/main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main.cpp b/src/main.cpp index 9b6d176..593e5e8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -7,6 +7,7 @@ int main(int argc, char *argv[]){ ProgramRunner runner = ProgramRunner(argc, argv); + runner.warmup(); ProgramRunner::ProgramStatus status; while (!runner.is_finished()) { status = runner.iterate();