mirror of
https://github.com/KjellKod/g3log.git
synced 2025-01-19 00:46:03 +01:00
Made sure the g2log performance tests + unit test are running on windows
(google performance test not tested yet on windows)
This commit is contained in:
parent
8c6a676648
commit
4659afdeb5
@ -72,7 +72,7 @@ ENDIF(UNIX)
|
||||
#Visual Studio 2010
|
||||
IF(WIN32)
|
||||
MESSAGE("")
|
||||
MESSAGE("cmake for Visual Studio 2010")
|
||||
MESSAGE("Windows: Please run the command [cmake -G \"Visual Studio 10\" ..]")
|
||||
MESSAGE("if cmake finishes OK, do 'msbuild g2log_by_kjellkod.sln'")
|
||||
MESSAGE("then run 'Debug\\g2log-example.exe' or whatever performance test you feel like trying")
|
||||
MESSAGE("")
|
||||
@ -140,6 +140,7 @@ ENDIF(WIN32)
|
||||
|
||||
# 1. create the the example EXECUTABLE - hook in the test_example's CMakeLists.txt file
|
||||
if (USE_SIMPLE_EXAMPLE)
|
||||
MESSAGE(" g2log-example option ON")
|
||||
include_directories (${DIR_EXAMPLE})
|
||||
add_executable(g2log-example ${DIR_EXAMPLE}/main.cpp)
|
||||
target_link_libraries(g2log-example lib_activeobject lib_g2logger ${PLATFORM_LINK_LIBRIES})
|
||||
@ -149,6 +150,7 @@ ENDIF(WIN32)
|
||||
|
||||
# 2. create the g2log's performance tests
|
||||
if (USE_G2LOG_PERFORMANCE)
|
||||
MESSAGE(" g2log performance tests option ON")
|
||||
include_directories (${DIR_PERFORMANCE})
|
||||
# MEAN PERFORMANCE TEST
|
||||
add_executable(g2log-performance-threaded_mean
|
||||
@ -169,6 +171,7 @@ ENDIF(WIN32)
|
||||
|
||||
# 3. create the Google glog's performance test
|
||||
if (USE_GOOGLE_GLOG_PERFORMANCE)
|
||||
MESSAGE(" Google's glog performance tests option ON")
|
||||
include_directories (${DIR_PERFORMANCE})
|
||||
# create the the GOOGLE MEAN_PERFORMANCE executable
|
||||
add_executable(google_glog-performance-threaded_mean ${DIR_PERFORMANCE}/main_threaded_mean.cpp ${DIR_PERFORMANCE}/performance.h)
|
||||
@ -185,6 +188,7 @@ ENDIF(WIN32)
|
||||
|
||||
# 4. create the unit tests for g2log --- ONLY TESTED THE UNIT TEST ON LINUX
|
||||
if (USE_G2LOG_UNIT_TEST)
|
||||
MESSAGE(" g2log unit testing option ON")
|
||||
# SETUP for GTEST
|
||||
set(GTEST_DIR ../3rdParty/gtest/gtest-1.6.0__stripped)
|
||||
set(GTEST_INCLUDE_DIRECTORIES ${GTEST_DIR}/include ${GTEST_DIR} ${GTEST_DIR}/src)
|
||||
|
@ -17,9 +17,11 @@ const std::string title = "GOOGLE__GLOG";
|
||||
#error G2LOG_PERFORMANCE or GOOGLE_GLOG_PERFORMANCE was not defined
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
const std::string g_path = "/tmp/";
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
|
||||
const std::string g_path = "./";
|
||||
#else
|
||||
const std::string g_path = "/tmp/";
|
||||
#endif
|
||||
using namespace g2_test;
|
||||
|
||||
int main(int argc, char** argv)
|
||||
@ -38,13 +40,13 @@ int main(int argc, char** argv)
|
||||
std::ostringstream thread_count_oss;
|
||||
thread_count_oss << number_of_threads;
|
||||
const std::string g_prefix_log_name = title + "-performance-" + thread_count_oss.str() + "threads-MEAN_LOG";
|
||||
const std::string g_measurement_dump= "/tmp/" + g_prefix_log_name + "_RESULT.txt";
|
||||
const std::string g_measurement_dump= g_path + g_prefix_log_name + "_RESULT.txt";
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "\n\n" << title << " performance " << number_of_threads << " threads MEAN times\n";
|
||||
oss << "Each thread running #: " << g_loop << " * " << g_iterations << " iterations of log entries" << std::endl; // worst mean case is about 10us per log entry
|
||||
const size_t xtra_margin = 2;
|
||||
oss << "*** It can take som time. Please wait: Approximate wait time is: " <<number_of_threads* (long long) (g_iterations * 10 * xtra_margin / 1000000 ) << " seconds" << std::endl;
|
||||
oss << "*** It can take som time. Please wait: Approximate wait time on MY PC was: " <<number_of_threads* (long long) (g_iterations * 10 * xtra_margin / 1000000 ) << " seconds" << std::endl;
|
||||
writeTextToFile(g_measurement_dump, oss.str(), kAppend);
|
||||
oss.str(""); // clear the stream
|
||||
|
||||
|
@ -22,7 +22,15 @@ const std::string title = "GOOGLE__GLOG";
|
||||
#error G2LOG_PERFORMANCE or GOOGLE_GLOG_PERFORMANCE was not defined
|
||||
#endif
|
||||
|
||||
const std::string g_path = "/tmp/";
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32) || defined(__WIN32__))
|
||||
const std::string g_path = "./";
|
||||
#else
|
||||
const std::string g_path = "/tmp/";
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
using namespace g2_test;
|
||||
|
||||
|
||||
@ -46,8 +54,8 @@ int main(int argc, char** argv)
|
||||
thread_count_oss << number_of_threads;
|
||||
|
||||
const std::string g_prefix_log_name = title + "-performance-" + thread_count_oss.str() + "threads-WORST_LOG";
|
||||
const std::string g_measurement_dump= "/tmp/" + g_prefix_log_name + "_RESULT.txt";
|
||||
const std::string g_measurement_bucket_dump= "/tmp/" + g_prefix_log_name + "_RESULT_buckets.txt";
|
||||
const std::string g_measurement_dump= g_path + g_prefix_log_name + "_RESULT.txt";
|
||||
const std::string g_measurement_bucket_dump= g_path + g_prefix_log_name + "_RESULT_buckets.txt";
|
||||
|
||||
|
||||
|
||||
@ -56,7 +64,7 @@ int main(int argc, char** argv)
|
||||
oss << "\n\n" << title << " performance " << number_of_threads << " threads WORST (PEAK) times\n";
|
||||
oss << "Each thread running #: " << g_loop << " * " << g_iterations << " iterations of log entries" << std::endl; // worst mean case is about 10us per log entry
|
||||
const size_t xtra_margin = 2;
|
||||
oss << "*** It can take som time. Please wait: Approximate wait time is: " << number_of_threads * (long long) (g_iterations * 10 * xtra_margin / 1000000 ) << " seconds" << std::endl;
|
||||
oss << "*** It can take som time. Please wait: Approximate wait time on MY PC was: " << number_of_threads * (long long) (g_iterations * 10 * xtra_margin / 1000000 ) << " seconds" << std::endl;
|
||||
writeTextToFile(g_measurement_dump, oss.str(), kAppend);
|
||||
oss.str(""); // clear the stream
|
||||
|
||||
|
@ -289,6 +289,7 @@ TEST(LogTest, LOG_IF__FATAL__NO_THROW)
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
std::cerr << e.what() << std::endl;
|
||||
logger.reset();
|
||||
ADD_FAILURE() << "Didn't throw exception as expected";
|
||||
}
|
||||
@ -387,6 +388,7 @@ TEST(CHECK, CHECK_ThatWontThrow)
|
||||
}
|
||||
catch (std::exception const &e)
|
||||
{
|
||||
std::cerr << e.what() << std::endl;
|
||||
ADD_FAILURE() << "Should never have thrown";
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user