]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/filesystem/test/path_times.cpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / filesystem / test / path_times.cpp
index 1da54b29e7b7c3c1d6dd636eebd1d0347ad5c748..8d9a032e660df5c17ad9a00f621a6cc37e1fecaf 100644 (file)
 #include <boost/config/warning_disable.hpp>
 
 #ifndef BOOST_FILESYSTEM_NO_DEPRECATED
-#  define BOOST_FILESYSTEM_NO_DEPRECATED
+#define BOOST_FILESYSTEM_NO_DEPRECATED
 #endif
 #ifndef BOOST_SYSTEM_NO_DEPRECATED
-#  define BOOST_SYSTEM_NO_DEPRECATED
+#define BOOST_SYSTEM_NO_DEPRECATED
 #endif
 
 #include <boost/timer/timer.hpp>
 #include <boost/filesystem/path.hpp>
 #include <boost/cstdint.hpp>
 
-#include <boost/config.hpp>
-# if defined( BOOST_NO_STD_WSTRING )
-#   error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support
-# endif
-
 #include <boost/detail/lightweight_main.hpp>
 
 namespace fs = boost::filesystem;
@@ -36,38 +31,37 @@ using namespace boost::timer;
 using std::cout;
 using std::endl;
 
-namespace
-{
-  boost::int64_t max_cycles;
+namespace {
+boost::int64_t max_cycles;
 
-  template <class STD_STRING>
-  nanosecond_type time_ctor(const STD_STRING& s)
-  {
+template< class STD_STRING >
+nanosecond_type time_ctor(const STD_STRING& s)
+{
     boost::timer::auto_cpu_timer tmr;
     boost::int64_t count = 0;
     do
     {
-      fs::path p(s);
-      ++count;
+        fs::path p(s);
+        ++count;
     } while (count < max_cycles);
 
     boost::timer::cpu_times elapsed = tmr.elapsed();
     return elapsed.user + elapsed.system;
-  }
+}
 
-  nanosecond_type time_loop()
-  {
+nanosecond_type time_loop()
+{
     boost::timer::auto_cpu_timer tmr;
     boost::int64_t count = 0;
     do
     {
-      ++count;
+        ++count;
     } while (count < max_cycles);
 
     boost::timer::cpu_times elapsed = tmr.elapsed();
     return elapsed.user + elapsed.system;
-  }
-}  // unnamed namespace
+}
+} // unnamed namespace
 
 //--------------------------------------------------------------------------------------//
 //                                      main                                            //
@@ -75,29 +69,29 @@ namespace
 
 int cpp_main(int argc, char* argv[])
 {
-  if (argc != 2)
-  {
-    cout << "Usage: path_times <cycles-in-millions>\n";
-    return 1;
-  }
+    if (argc != 2)
+    {
+        cout << "Usage: path_times <cycles-in-millions>\n";
+        return 1;
+    }
 
-  max_cycles = std::atoi(argv[1]) * 1000000LL;
-  cout << "testing " << std::atoi(argv[1]) << " million cycles" << endl;
+    max_cycles = std::atoi(argv[1]) * 1000000LL;
+    cout << "testing " << std::atoi(argv[1]) << " million cycles" << endl;
 
-  cout << "time_loop" << endl;
-  nanosecond_type x = time_loop();
+    cout << "time_loop" << endl;
+    nanosecond_type x = time_loop();
 
-  cout << "time_ctor with string" << endl;
-  nanosecond_type s = time_ctor(std::string("/foo/bar/baz"));
+    cout << "time_ctor with string" << endl;
+    nanosecond_type s = time_ctor(std::string("/foo/bar/baz"));
 
-  cout << "time_ctor with wstring" << endl;
-  nanosecond_type w = time_ctor(std::wstring(L"/foo/bar/baz"));
+    cout << "time_ctor with wstring" << endl;
+    nanosecond_type w = time_ctor(std::wstring(L"/foo/bar/baz"));
 
-  if (s > w)
-    cout << "narrow/wide CPU-time ratio = " << long double(s)/w << endl;
-  else
-    cout << "wide/narrow CPU-time ratio = " << long double(w)/s << endl;
+    if (s > w)
+        cout << "narrow/wide CPU-time ratio = " << long double(s) / w << endl;
+    else
+        cout << "wide/narrow CPU-time ratio = " << long double(w) / s << endl;
 
-  cout << "returning from main()" << endl;
-  return 0;
+    cout << "returning from main()" << endl;
+    return 0;
 }