From 77520edff113c8dfa19c83677e36cc3fb47ce2a7 Mon Sep 17 00:00:00 2001 From: Beman Date: Fri, 24 May 2013 11:28:26 -0400 Subject: [PATCH] Change speed_test.cpp output to HTML --- test/msvc2012/speed_test/speed_test.vcxproj | 2 +- test/speed_test.cpp | 95 ++++++++------------- 2 files changed, 37 insertions(+), 60 deletions(-) diff --git a/test/msvc2012/speed_test/speed_test.vcxproj b/test/msvc2012/speed_test/speed_test.vcxproj index 181b816..ed19c99 100644 --- a/test/msvc2012/speed_test/speed_test.vcxproj +++ b/test/msvc2012/speed_test/speed_test.vcxproj @@ -80,7 +80,7 @@ true - "$(TargetDir)\$(TargetName).exe" 1000000000 + "$(TargetDir)\$(TargetName).exe" 100000000 diff --git a/test/speed_test.cpp b/test/speed_test.cpp index c31faa9..cdede93 100644 --- a/test/speed_test.cpp +++ b/test/speed_test.cpp @@ -7,7 +7,7 @@ //--------------------------------------------------------------------------------------// -//#define BOOST_ENDIAN_NO_INTRINSICS +#define BOOST_ENDIAN_NO_INTRINSICS //#define BOOST_ENDIAN_LOG #include @@ -32,7 +32,7 @@ namespace typedef boost::timer::nanosecond_type nanosecond_t; std::string command_args; uint64_t n; // number of test cases to run - int places = 3; // decimal places for times + int places = 2; // decimal places for times bool verbose (false); void process_command_line(int argc, char * argv[]) @@ -44,7 +44,7 @@ namespace command_args += ' '; } - cout << command_args << '\n';; + // cout << command_args << '\n';; if (argc >=2) #ifndef _MSC_VER @@ -86,99 +86,79 @@ namespace T x(0); T y(0); EndianT z(0); - boost::timer::auto_cpu_timer t(places); + boost::timer::cpu_timer t; for (uint64_t i = 0; i < n; ++i) { f(x, y, z); } t.stop(); - boost::timer::cpu_times times = t.elapsed(); -// result.cpu_time = (times.system + times.user); - t.report(); + cout << "" << t.format(places, "%t") << " s"; } void test_big_int16() { - cout << " no +\n "; + cout << "16-bit aligned big endian"; time(user::return_x_big_int16); - cout << " + int16_t argument\n "; time(user::return_x_plus_y_big_int16); - cout << " + int16_t by value\n "; time(user::return_x_plus_y_value_big_int16); - cout << " + int16_t in place\n "; time(user::return_x_plus_y_in_place_big_int16); - cout << " + big_int16_t\n "; time(user::return_x_plus_z_big_int16); + cout << "\n"; } void test_little_int16() { - cout << " no +\n "; + cout << "16-bit aligned little endian"; time(user::return_x_little_int16); - cout << " + int16_t argument\n "; time(user::return_x_plus_y_little_int16); - cout << " + int16_t by value\n "; time(user::return_x_plus_y_value_little_int16); - cout << " + int16_t in place\n "; time(user::return_x_plus_y_in_place_little_int16); - cout << " + little_int16_t\n "; time(user::return_x_plus_z_little_int16); + cout << "\n"; } void test_big_int32() { - cout << " no +\n "; + cout << "32-bit aligned big endian"; time(user::return_x_big_int32); - cout << " + int32_t argument\n "; time(user::return_x_plus_y_big_int32); - cout << " + int32_t by value\n "; time(user::return_x_plus_y_value_big_int32); - cout << " + int32_t in place\n "; time(user::return_x_plus_y_in_place_big_int32); - cout << " + big_int32_t\n "; time(user::return_x_plus_z_big_int32); + cout << "\n"; } void test_little_int32() { - cout << " no +\n "; + cout << "32-bit aligned little endian"; time(user::return_x_little_int32); - cout << " + int32_t argument\n "; time(user::return_x_plus_y_little_int32); - cout << " + int32_t by value\n "; time(user::return_x_plus_y_value_little_int32); - cout << " + int32_t in place\n "; time(user::return_x_plus_y_in_place_little_int32); - cout << " + little_int32_t\n "; time(user::return_x_plus_z_little_int32); + cout << "\n"; } void test_big_int64() { - cout << " no +\n "; + cout << "64-bit aligned big endian"; time(user::return_x_big_int64); - cout << " + int64_t argument\n "; time(user::return_x_plus_y_big_int64); - cout << " + int64_t by value\n "; time(user::return_x_plus_y_value_big_int64); - cout << " + int64_t in place\n "; time(user::return_x_plus_y_in_place_big_int64); - cout << " + big_int64_t\n "; time(user::return_x_plus_z_big_int64); + cout << "\n"; } void test_little_int64() { - cout << " no +\n "; + cout << "64-bit aligned little endian"; time(user::return_x_little_int64); - cout << " + int64_t argument\n "; time(user::return_x_plus_y_little_int64); - cout << " + int64_t by value\n "; time(user::return_x_plus_y_value_little_int64); - cout << " + int64_t in place\n "; time(user::return_x_plus_y_in_place_little_int64); - cout << " + little_int64_t\n "; time(user::return_x_plus_z_little_int64); + cout << "\n"; } } // unnamed namespace @@ -189,36 +169,33 @@ int cpp_main(int argc, char* argv[]) { process_command_line(argc, argv); - cout << "\nbyte swap intrinsics used: " BOOST_ENDIAN_INTRINSIC_MSG << endl; + cout + << "\n\nEndian Speed Test\n\n\n" + << "\n" + << "\n" + << "\n" + << "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + "\n" + ; - cout << endl << "------------------------------------------------------" << endl; - - cout << endl << "big, 16-bit..." << endl; test_big_int16(); - cout << endl << "little, 16-bit..." << endl; test_little_int16(); - - cout << endl << "------------------------------------------------------" << endl; - - cout << endl << "big, 32-bit..." << endl; test_big_int32(); - cout << endl << "little, 32-bit..." << endl; test_little_int32(); - - cout << endl << "------------------------------------------------------" << endl; - - cout << endl << "big, 64-bit..." << endl; test_big_int64(); - cout << endl << "little, 64-bit..." << endl; test_little_int64(); - cout << endl << "------------------------------------------------------" << endl; - - //cout << "float" << endl; - //test(1.2345f); - - //cout << "double" << endl; - //test(1.23456789); + cout << "\n
" + << BOOST_COMPILER << "
" + << " Iterations: " << n + << ", Intrinsics: " BOOST_ENDIAN_INTRINSIC_MSG + << "
Test Casexx+yx+v(y)x+in(y)x+z
\n\n\n"; return 0; }