From 525b46055e689678fbd425ea490c19989f988cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Fri, 23 Oct 2020 14:14:15 +0200 Subject: [PATCH] - Make sure testsuite works with "exception-handling=off" --- bench/Jamfile.v2 | 2 +- bench/bench_adaptive_node_pool.cpp | 9 ++-- bench/bench_alloc.cpp | 8 ++-- bench/bench_alloc_expand_bwd.cpp | 8 ++-- bench/bench_alloc_expand_fwd.cpp | 8 ++-- bench/bench_alloc_shrink_to_fit.cpp | 8 ++-- bench/bench_alloc_stable_vector_burst.cpp | 8 ++-- bench/bench_set.hpp | 51 ++++++++++++----------- bench/bench_static_vector.cpp | 23 +++++----- bench/bench_vectors.cpp | 8 ++-- 10 files changed, 68 insertions(+), 65 deletions(-) diff --git a/bench/Jamfile.v2 b/bench/Jamfile.v2 index 9cf993d..8c416ed 100644 --- a/bench/Jamfile.v2 +++ b/bench/Jamfile.v2 @@ -21,7 +21,7 @@ rule test_all for local fileb in [ glob *.cpp ] { - all_rules += [ run $(fileb) /boost/container//boost_container /boost/timer//boost_timer + all_rules += [ run $(fileb) /boost/container//boost_container : # additional args : # test-files : # requirements diff --git a/bench/bench_adaptive_node_pool.cpp b/bench/bench_adaptive_node_pool.cpp index acb0750..28b316d 100644 --- a/bench/bench_adaptive_node_pool.cpp +++ b/bench/bench_adaptive_node_pool.cpp @@ -29,10 +29,11 @@ #include //std::size_t #include //assert -#include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +#include + +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; namespace bc = boost::container; diff --git a/bench/bench_alloc.cpp b/bench/bench_alloc.cpp index 5f1c3ee..af0fe26 100644 --- a/bench/bench_alloc.cpp +++ b/bench/bench_alloc.cpp @@ -22,10 +22,10 @@ #include //typeid #include //assert -#include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +#include +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; using namespace boost::container; diff --git a/bench/bench_alloc_expand_bwd.cpp b/bench/bench_alloc_expand_bwd.cpp index b3249b9..7e2caa9 100644 --- a/bench/bench_alloc_expand_bwd.cpp +++ b/bench/bench_alloc_expand_bwd.cpp @@ -22,10 +22,10 @@ #include //std::cout, std::endl #include //assert -#include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +#include +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; namespace bc = boost::container; diff --git a/bench/bench_alloc_expand_fwd.cpp b/bench/bench_alloc_expand_fwd.cpp index d03a75e..4fc5c61 100644 --- a/bench/bench_alloc_expand_fwd.cpp +++ b/bench/bench_alloc_expand_fwd.cpp @@ -23,11 +23,11 @@ #include //std::allocator #include //std::cout, std::endl #include //std::strcmp -#include +#include #include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; namespace bc = boost::container; diff --git a/bench/bench_alloc_shrink_to_fit.cpp b/bench/bench_alloc_shrink_to_fit.cpp index 0edb2fe..aa65a54 100644 --- a/bench/bench_alloc_shrink_to_fit.cpp +++ b/bench/bench_alloc_shrink_to_fit.cpp @@ -24,10 +24,10 @@ #include //std::cout, std::endl #include //assert -#include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +#include +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; namespace bc = boost::container; diff --git a/bench/bench_alloc_stable_vector_burst.cpp b/bench/bench_alloc_stable_vector_burst.cpp index 1e299b3..9adda0b 100644 --- a/bench/bench_alloc_stable_vector_burst.cpp +++ b/bench/bench_alloc_stable_vector_burst.cpp @@ -26,11 +26,11 @@ #include #include #include -#include +#include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; namespace bc = boost::container; diff --git a/bench/bench_set.hpp b/bench/bench_set.hpp index f4a54bd..7211b9a 100644 --- a/bench/bench_set.hpp +++ b/bench/bench_set.hpp @@ -12,7 +12,7 @@ #define BOOST_CONTAINER_BENCH_BENCH_SET_HPP #include -#include +#include #include //sort #include #include @@ -21,9 +21,9 @@ #include #include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; #define SIMPLE_IT #ifdef SIMPLE_IT @@ -39,9 +39,9 @@ static const std::size_t NIter = 3; static const std::size_t NElements = 1000; -void compare_times(cpu_times time_numerator, cpu_times time_denominator){ - std::cout << ((double)time_numerator.wall/(double)time_denominator.wall) << std::endl; - std::cout << "----------------------------------------------" << '\n' << std::endl; +void compare_times(cpu_times time_numerator, cpu_times time_denominator) +{ + std::cout << ((double)time_numerator.wall/(double)time_denominator.wall) << '\n' << std::endl; } template< class RandomIt > @@ -183,10 +183,10 @@ cpu_times copy_destroy_time(boost::container::vector &un } total_time.stop(); - std::cout << " Copy sorted range " << boost::timer::format(copy_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Assign sorted range " << boost::timer::format(assign_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Destroy " << boost::timer::format(destroy_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Total time = " << boost::timer::format(total_time.elapsed(), boost::timer::default_places, "%ws\n") << std::endl; + std::cout << " Copy sorted range " << double(copy_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Assign sorted range " << double(assign_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Destroy " << double(destroy_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Total time = " << double(total_time.elapsed().wall)/double(1000000000) << "s\n"; return total_time.elapsed(); } @@ -216,9 +216,9 @@ cpu_times construct_time( boost::container::vector &uniq } } - std::cout << " Construct " << RangeType << " unique_range " << boost::timer::format(sur_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Construct " << RangeType << " range " << boost::timer::format(sr_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Total time = " << boost::timer::format(total_time.elapsed(), boost::timer::default_places, "%ws\n") << std::endl; + std::cout << " Construct " << RangeType << " unique_range " << double(sur_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Construct " << RangeType << " range " << double(sr_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Total time = " << double(total_time.elapsed().wall)/double(1000000000) << "s\n"; return total_time.elapsed(); } @@ -252,9 +252,9 @@ cpu_times insert_time( boost::container::vector &unique_ } } - std::cout << " Insert " << RangeType << " unique_range " << boost::timer::format(ur_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Insert " << RangeType << " range " << boost::timer::format(r_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Total time = " << boost::timer::format(total_time.elapsed(), boost::timer::default_places, "%ws\n") << std::endl; + std::cout << " Insert " << RangeType << " unique_range " << double(ur_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Insert " << RangeType << " range " << double(r_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Total time = " << double(total_time.elapsed().wall)/double(1000000000) << "s\n"; return total_time.elapsed(); } @@ -357,12 +357,12 @@ cpu_times search_time(boost::container::vector &unique_r } total_time.stop(); - std::cout << " Find " << RangeType << " " << boost::timer::format(find_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Lower Bound " << RangeType << " " << boost::timer::format(lower_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Upper Bound " << RangeType << " " << boost::timer::format(upper_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Equal Range " << RangeType << " " << boost::timer::format(equal_range_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Count " << RangeType << " " << boost::timer::format(count_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Total time = " << boost::timer::format(total_time.elapsed(), boost::timer::default_places, "%ws\n") << std::endl; + std::cout << " Find " << RangeType << " " << double(find_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Lower Bound " << RangeType << " " << double(lower_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Upper Bound " << RangeType << " " << double(upper_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Equal Range " << RangeType << " " << double(equal_range_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Count " << RangeType << " " << double(count_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Total time = " << double(total_time.elapsed().wall)/double(1000000000) << "s\n"; return total_time.elapsed(); } @@ -385,8 +385,8 @@ void extensions_time(boost::container::vector &sorted_un } } - std::cout << " Construct sorted_unique_range " << boost::timer::format(sur_timer.elapsed(), boost::timer::default_places, "%ws\n"); - std::cout << " Construct sorted_unique_range (extension) " << boost::timer::format(sur_opt_timer.elapsed(), boost::timer::default_places, "%ws\n"); + std::cout << " Construct sorted_unique_range " << double(sur_timer.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Construct sorted_unique_range (extension) " << double(sur_opt_timer.elapsed().wall)/double(1000000000) << "s\n"; std::cout << "Extension/Standard: "; compare_times(sur_opt_timer.elapsed(), sur_timer.elapsed()); } @@ -396,6 +396,7 @@ void launch_tests(const char *BoostContName, const char *StdContName) { typedef range_provider get_range_t; + std::cout << std::fixed << std::setw( 11 ); std::cout << "**********************************************" << '\n'; std::cout << "**********************************************" << '\n'; std::cout << '\n'; diff --git a/bench/bench_static_vector.cpp b/bench/bench_static_vector.cpp index 914e7e4..390e57b 100644 --- a/bench/bench_static_vector.cpp +++ b/bench/bench_static_vector.cpp @@ -21,13 +21,14 @@ #include "../test/movable_int.hpp" #include #include -#include +#include #include #include +#include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; static const std::size_t N = 500; @@ -100,18 +101,18 @@ cpu_times time_it() destructionTime.stop(); } totalTime.stop(); - std::cout << " construction took " << boost::timer::format(constructTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n"); - std::cout << " sort took " << boost::timer::format(sortTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n"); - std::cout << " rotate took " << boost::timer::format(rotateTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n"); - std::cout << " destruction took " << boost::timer::format(destructionTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n"); - std::cout << " Total time = " << boost::timer::format(totalTime.elapsed(), 6, "%ws wall, %ts CPU (%p%)\n") << std::endl; + std::cout << std::fixed << std::setw( 11 ); + std::cout << " construction took " << double(constructTime.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " sort took " << double(sortTime.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " rotate took " << double(rotateTime.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " destruction took " << double(destructionTime.elapsed().wall)/double(1000000000) << "s\n"; + std::cout << " Total time = " << double(totalTime.elapsed().wall)/double(1000000000) << "s\n"; return totalTime.elapsed(); } void compare_times(cpu_times time_numerator, cpu_times time_denominator){ std::cout - << "\n wall = " << ((double)time_numerator.wall/(double)time_denominator.wall) - << "\n (user+sys) = " << ((double)(time_numerator.system+time_numerator.user)/(double)(time_denominator.system+time_denominator.user)) << "\n\n"; + << "\n wall = " << ((double)time_numerator.wall/(double)time_denominator.wall) << "\n\n"; } int main() diff --git a/bench/bench_vectors.cpp b/bench/bench_vectors.cpp index 1fae391..9def103 100644 --- a/bench/bench_vectors.cpp +++ b/bench/bench_vectors.cpp @@ -19,7 +19,7 @@ #include //std::allocator #include //std::cout, std::endl #include //std::strcmp -#include +#include #include //capacity @@ -30,9 +30,9 @@ #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 #include -using boost::timer::cpu_timer; -using boost::timer::cpu_times; -using boost::timer::nanosecond_type; +using boost::move_detail::cpu_timer; +using boost::move_detail::cpu_times; +using boost::move_detail::nanosecond_type; namespace bc = boost::container;