From c2432a20f66bd9389bfd4398d68d4023e13eb48f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Wo=CC=81jcik?= <3044353+pwojcikdev@users.noreply.github.com> Date: Sat, 23 Mar 2024 11:58:10 +0100 Subject: [PATCH] WIP --- nano/benchmarks/CMakeLists.txt | 2 +- nano/benchmarks/entry.cpp | 13 ------------- nano/benchmarks/stats.cpp | 14 ++++++++++++++ 3 files changed, 15 insertions(+), 14 deletions(-) create mode 100644 nano/benchmarks/stats.cpp diff --git a/nano/benchmarks/CMakeLists.txt b/nano/benchmarks/CMakeLists.txt index 97aa9665bb..dc3829303d 100644 --- a/nano/benchmarks/CMakeLists.txt +++ b/nano/benchmarks/CMakeLists.txt @@ -1,4 +1,4 @@ -add_executable(benchmarks entry.cpp) +add_executable(benchmarks entry.cpp stats.cpp) target_link_libraries(benchmarks test_common benchmark::benchmark) diff --git a/nano/benchmarks/entry.cpp b/nano/benchmarks/entry.cpp index e15af6677a..ed325334e8 100644 --- a/nano/benchmarks/entry.cpp +++ b/nano/benchmarks/entry.cpp @@ -1,5 +1,3 @@ -#include - #include static void BM_StringCreation (benchmark::State & state) @@ -19,15 +17,4 @@ static void BM_StringCopy (benchmark::State & state) } BENCHMARK (BM_StringCopy); -static void benchmark_stats_inc (benchmark::State & state) -{ - nano::stats stats; - - for (auto _ : state) - { - stats.inc (nano::stat::type::ledger, nano::stat::detail::open); - } -} -BENCHMARK (benchmark_stats_inc); - BENCHMARK_MAIN (); \ No newline at end of file diff --git a/nano/benchmarks/stats.cpp b/nano/benchmarks/stats.cpp new file mode 100644 index 0000000000..8f7a35006a --- /dev/null +++ b/nano/benchmarks/stats.cpp @@ -0,0 +1,14 @@ +#include + +#include + +static void benchmark_stats_inc (benchmark::State & state) +{ + nano::stats stats; + + for (auto _ : state) + { + stats.inc (nano::stat::type::ledger, nano::stat::detail::open); + } +} +BENCHMARK (benchmark_stats_inc);