X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fboost%2Flibs%2Fmultiprecision%2Fperformance%2Fsf_performance.hpp;fp=ceph%2Fsrc%2Fboost%2Flibs%2Fmultiprecision%2Fperformance%2Fsf_performance.hpp;h=1e5d155577bdd6daf452d1c91d333bcda0467029;hb=f67539c23b11f3b8a2ecaeeddf7a403ae1c442a8;hp=ce34f1b6f309cd31edc8cfb955b720c51aaafa4c;hpb=64a4c04e6850c6d9086e4c37f57c4eada541b05e;p=ceph.git diff --git a/ceph/src/boost/libs/multiprecision/performance/sf_performance.hpp b/ceph/src/boost/libs/multiprecision/performance/sf_performance.hpp index ce34f1b6f..1e5d15557 100644 --- a/ceph/src/boost/libs/multiprecision/performance/sf_performance.hpp +++ b/ceph/src/boost/libs/multiprecision/performance/sf_performance.hpp @@ -16,6 +16,14 @@ #define TEST_FLOAT #endif +#if defined(TEST_MPFR) && !defined(TEST_MPFR_CLASS) +#if defined(__has_include) +#if __has_include() +#define TEST_MPFR_CLASS +#endif +#endif +#endif + #ifdef TEST_FLOAT #include "arithmetic_backend.hpp" #endif @@ -36,7 +44,6 @@ #endif #ifdef TEST_CPP_BIN_FLOAT #include -#include #endif #include #include @@ -45,6 +52,7 @@ #include #include #include +#include template Real test_bessel(); @@ -156,7 +164,8 @@ Real test_nct() return result; } -extern unsigned allocation_count; +extern boost::atomic allocation_count; +extern std::map > > result_table; template void basic_allocation_test(const char* name, Real x) @@ -177,7 +186,7 @@ void poly_allocation_test(const char* name, Real x) } template -void time_proc(const char* name, Real (*proc)(), unsigned threads = 1) +void time_proc(const char* tablename, const char* name, Real (*proc)(), unsigned threads = 1) { try { @@ -190,16 +199,22 @@ void time_proc(const char* name, Real (*proc)(), unsigned threads = 1) std::cout << "Time for " << name << " = " << time << std::endl; std::cout << "Total allocations for " << name << " = " << allocation_count << std::endl; - for (unsigned thread_count = 1; thread_count < threads; ++thread_count) + result_table[tablename][name] = std::make_pair(time.count(), (unsigned)allocation_count); + + if (threads > 1) { c.reset(); boost::thread_group g; - for (unsigned i = 0; i <= thread_count; ++i) + for (unsigned i = 0; i < threads; ++i) g.create_thread(proc); g.join_all(); time = c.elapsed(); - std::cout << "Time for " << name << " (" << (thread_count + 1) << " threads) = " << time << std::endl; + std::cout << "Time for " << name << " (" << (threads) << " theads) = " << time << std::endl; std::cout << "Total allocations for " << name << " = " << allocation_count << std::endl; + + std::ostringstream ss; + ss << name << " (" << threads << " concurrent threads)"; + result_table[tablename][ss.str()] = std::make_pair(time.count(), (unsigned)allocation_count); } } catch (const std::exception& e) @@ -210,7 +225,15 @@ void time_proc(const char* name, Real (*proc)(), unsigned threads = 1) using namespace boost::multiprecision; -void basic_tests(); +void basic_tests_1(); +void basic_tests_2(); +void basic_tests_3(); +void basic_tests_4(); +void basic_tests_5(); +void basic_tests_6(); +void basic_tests_7(); +void basic_tests_8(); +void basic_tests_9(); void bessel_tests(); void poly_tests(); void nct_tests();