From 96eafea12583669ff0084b2e780fc6165548b43c Mon Sep 17 00:00:00 2001 From: "jan.reininghaus" Date: Mon, 6 May 2013 09:13:06 +0000 Subject: changed benchmark behavior git-svn-id: https://phat.googlecode.com/svn/trunk@62 8e3bb3c2-eed4-f18f-5264-0b6c94e6926d --- src/benchmark.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/benchmark.cpp b/src/benchmark.cpp index 634fd4c..55538fd 100644 --- a/src/benchmark.cpp +++ b/src/benchmark.cpp @@ -30,6 +30,8 @@ #include #include +#include + #include #include @@ -122,16 +124,23 @@ void compute( std::string input_filename, print_help_and_exit(); } - double pairs_timer = omp_get_wtime(); - phat::persistence_pairs pairs; + Algorithm reduction_algorithm; + double reduction_timer = -1; if( ansatz == PRIMAL ) { std::cout << " primal"; - phat::compute_persistence_pairs< Algorithm > ( pairs, matrix ); + reduction_timer = omp_get_wtime(); + reduction_algorithm( matrix ); } else { std::cout << " dual"; - phat::compute_persistence_pairs_dualized< Algorithm > ( pairs, matrix ); + dualize( matrix ); + reduction_timer = omp_get_wtime(); + reduction_algorithm( matrix ); } - std::cout << " " << setiosflags( std::ios::fixed ) << setiosflags( std::ios::showpoint ) << std::setprecision( 1 ) << omp_get_wtime() - pairs_timer <<"s" << std::endl; + double running_time = omp_get_wtime() - reduction_timer; + double running_time_rounded = floor( running_time * 10.0 + 0.5 ) / 10.0; + + //std::cout << " " << setiosflags( std::ios::fixed ) << setiosflags( std::ios::showpoint ) << std::setprecision( 4 ) << running_time <<"s" << std::endl; + std::cout << " " << setiosflags( std::ios::fixed ) << setiosflags( std::ios::showpoint ) << std::setprecision( 1 ) << running_time_rounded <<"s" << std::endl; } -- cgit v1.2.3