You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by ts...@apache.org on 2021/12/30 08:04:30 UTC

[logging-log4cxx] branch master updated: Don't calculate results more than once.

This is an automated email from the ASF dual-hosted git repository.

tschoening pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/logging-log4cxx.git


The following commit(s) were added to refs/heads/master by this push:
     new 61052dc  Don't calculate results more than once.
61052dc is described below

commit 61052dc827848ada018175eb12b7de457d145f4e
Author: Thorsten Schöning <ts...@am-soft.de>
AuthorDate: Thu Dec 30 09:04:23 2021 +0100

    Don't calculate results more than once.
---
 src/test/cpp/throughput/throughput-main.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/test/cpp/throughput/throughput-main.cpp b/src/test/cpp/throughput/throughput-main.cpp
index 9f47a82..bb5b7bc 100644
--- a/src/test/cpp/throughput/throughput-main.cpp
+++ b/src/test/cpp/throughput/throughput-main.cpp
@@ -45,12 +45,11 @@ static void benchmark_function( const std::string& name, void (*fn)(int), int ho
 	auto delta = high_resolution_clock::now() - start;
 	auto delta_d = duration_cast<duration<double>>(delta).count();
 
+	results.push_back( uint64_t(howmany / delta_d) );
 	LOG4CXX_INFO_FMT( console, "Log4cxx {} Elapsed: {:.4} secs {:L}/sec",
 		name,
 		delta_d,
-		uint64_t(howmany / delta_d));
-
-	results.push_back( uint64_t(howmany / delta_d) );
+		results.back() );
 }
 
 static void benchmark_conversion_pattern( const std::string& name,
@@ -68,13 +67,12 @@ static void benchmark_conversion_pattern( const std::string& name,
 	auto delta = high_resolution_clock::now() - start;
 	auto delta_d = duration_cast<duration<double>>(delta).count();
 
+	results.push_back( uint64_t(howmany / delta_d) );
 	LOG4CXX_INFO_FMT( console, "Log4cxx {} pattern: {} Elapsed: {:.4} secs {:L}/sec",
 		name,
 		conversion_pattern,
 		delta_d,
-		uint64_t(howmany / delta_d) );
-
-	results.push_back( uint64_t(howmany / delta_d) );
+		results.back() );
 }
 
 static void bench_log4cxx_single_threaded(int iters)