]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/multiprecision/performance/sf_performance.hpp
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / boost / libs / multiprecision / performance / sf_performance.hpp
index ce34f1b6f309cd31edc8cfb955b720c51aaafa4c..1e5d155577bdd6daf452d1c91d333bcda0467029 100644 (file)
 #define TEST_FLOAT
 #endif
 
+#if defined(TEST_MPFR) && !defined(TEST_MPFR_CLASS)
+#if defined(__has_include)
+#if __has_include(<gmpfrxx.h>)
+#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 <boost/multiprecision/cpp_bin_float.hpp>
-#include <boost/multiprecision/mpfr.hpp>
 #endif
 #include <boost/math/special_functions/bessel.hpp>
 #include <boost/math/tools/rational.hpp>
@@ -45,6 +52,7 @@
 #include <boost/chrono.hpp>
 #include <boost/array.hpp>
 #include <boost/thread.hpp>
+#include <boost/atomic.hpp>
 
 template <class Real>
 Real test_bessel();
@@ -156,7 +164,8 @@ Real test_nct()
    return result;
 }
 
-extern unsigned allocation_count;
+extern boost::atomic<unsigned>                                                     allocation_count;
+extern std::map<std::string, std::map<std::string, std::pair<double, unsigned> > > result_table;
 
 template <class Real>
 void basic_allocation_test(const char* name, Real x)
@@ -177,7 +186,7 @@ void poly_allocation_test(const char* name, Real x)
 }
 
 template <class Real>
-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();