From ab867826bca92f7aabdd4fe3afc96356bd0f5208 Mon Sep 17 00:00:00 2001 From: Kjell Hedstrom Date: Fri, 15 Dec 2023 16:58:46 -0700 Subject: [PATCH] making sure we are using the same type of clock --- benchmark/benchmark_functions.hpp | 1 + benchmark/benchmark_main.cpp | 10 +++++----- benchmark/stopwatch.hpp | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/benchmark/benchmark_functions.hpp b/benchmark/benchmark_functions.hpp index c8981ad..60c2814 100644 --- a/benchmark/benchmark_functions.hpp +++ b/benchmark/benchmark_functions.hpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include "q/q_api.hpp" diff --git a/benchmark/benchmark_main.cpp b/benchmark/benchmark_main.cpp index b74098e..1a24279 100644 --- a/benchmark/benchmark_main.cpp +++ b/benchmark/benchmark_main.cpp @@ -25,12 +25,12 @@ namespace { void print_result(const benchmark_result& result) { double average_call_time_ns = result.mean_msgs_per_second ? 1e9 / result.mean_msgs_per_second : 0; - std::cout << std::left << std::setw(2) << result.runs << ", " - << std::setw(5) << result.num_producer_threads << ", " + std::cout << std::left << std::setw(6) << result.runs << ", " + << std::setw(6) << result.num_producer_threads << ", " << std::setw(6) << result.num_consumer_threads << ", " - << std::setw(16) << result.mean_msgs_per_second << ", " - << std::setw(14) << result.min_msgs_per_second << ", " - << std::setw(14) << result.max_msgs_per_second << ", " + << std::setw(12) << result.mean_msgs_per_second << ", " + << std::setw(12) << result.min_msgs_per_second << ", " + << std::setw(12) << result.max_msgs_per_second << ", " << std::setw(10) << average_call_time_ns << "," << std::setw(30) << result.comment << std::endl; } diff --git a/benchmark/stopwatch.hpp b/benchmark/stopwatch.hpp index d6c417c..e30654c 100644 --- a/benchmark/stopwatch.hpp +++ b/benchmark/stopwatch.hpp @@ -21,7 +21,7 @@ namespace benchmark { using milliseconds = std::chrono::milliseconds; using microseconds = std::chrono::microseconds; using nanoseconds = std::chrono::nanoseconds; - using clock = std::chrono::steady_clock; + using clock = std::chrono::high_resolution_clock; clock::time_point start_; stopwatch() :