From 40c9aa5be2ca561cf15235310910c52bd87239ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjell=20Hedstr=C3=B6m?= <331742+KjellKod@users.noreply.github.com> Date: Tue, 2 Jan 2024 11:41:00 -0700 Subject: [PATCH] profiling update do not merge to master --- .DS_Store | Bin 8196 -> 0 bytes CMakeLists.txt | 2 ++ test_performance/Performance.cmake | 26 ++++++++++++++++++++++++-- test_unit/Test.cmake | 3 ++- 4 files changed, 28 insertions(+), 3 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 83fa468f4831eb3282c575a2ecd56bb572662927..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHM&2G~`5T0#Q;t*N_0;xzKS#YgNN-3h^lBNwPQcIyp;Q%N&iCe5Xc9fr{s4B`G zo`F~3%!}|C+&RHFyKZE=ap6)_sk_nc?Ar6q?tVM7_Buo)iv8vS(JT=e$SiYN6k`(K z=X@ef1XpfD3gC%$$e~@Dr;pS+p{*}y1~dbj0nLDBKr?V27{D`|lacV;S9f)(8PE(| zNCtR+Fp*gn0y$JtZXGD(5dboU%QB&kbAZH{fh+`asHB9#raC={04jnbhEQH z?U5ZreU71KXce|?=z18li(fMKR}4Fq)XT(fOp|-rP~)L>%%)2{TN*{bci zEzf6ykVNo&qG{D0m0wUBO?WK4K>1K6kN1Hk{i= z$XReWTRLI`EgueG%OLjPL_K5<>Mk6F!_CIRCIt~fFVaT_h)t@Tg1~$uh?xNKFChzu zh+xxjp)wq*1ox{@DLQ|4i-`7R@U(aALKq=`Y>aO@%-N?9XVaKXJH$vL6NFHUAZOv` z+Zf+Ef@}*Te2G>GqpYG`MQsE3*Re)iPYAn+y^OT7f|c4xKrpl6v8S5m0hZ+1CVlWp%w59Lu$W5Qo9>y244exFL~5V;FU1VJ1v$l!+ z9+?yC4V9D-6!JI@DUaijqdyE$H=)XyLLi4q;tJCL{}8}$MEd#9?~VHTFJ16L7JmR# CA2&w; diff --git a/CMakeLists.txt b/CMakeLists.txt index ac78173..49dfe08 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,6 +42,8 @@ cmake_minimum_required(VERSION 3.2) project(g3log CXX) +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/test_performance/Performance.cmake b/test_performance/Performance.cmake index 83bfd62..53cd4f2 100644 --- a/test_performance/Performance.cmake +++ b/test_performance/Performance.cmake @@ -22,10 +22,32 @@ # ========================= IF (ADD_G3LOG_BENCH_PERFORMANCE) set(DIR_PERFORMANCE ${g3log_SOURCE_DIR}/test_performance) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") message( STATUS "-DADD_G3LOG_BENCH_PERFORMANCE=ON" ) include_directories (${DIR_PERFORMANCE}) + find_library(TCMALLOC_LIBRARY NAMES tcmalloc) + if(NOT TCMALLOC_LIBRARY) + message(FATAL_ERROR "tcmalloc library not found") + else() + message( STATUS "tcmalloc: ${TCMALLOC_LIBRARY} was found" ) + endif() + + find_library(PROFILER NAMES profiler) + if(NOT PROFILER) + message(FATAL_ERROR "PROFILER library not found") + else() + message( STATUS "PROFILER: ${PROFILER} was found" ) + endif() + + + # add_executable(your_executable ${YOUR_SOURCES}) + # target_link_libraries(your_executable PRIVATE ${TCMALLOC_LIBRARY}) + + + # MEAN PERFORMANCE TEST add_executable(g3log-performance-threaded_mean ${DIR_PERFORMANCE}/main_threaded_mean.cpp @@ -34,7 +56,7 @@ set_target_properties(g3log-performance-threaded_mean PROPERTIES COMPILE_DEFINITIONS "G3LOG_PERFORMANCE=1") target_link_libraries(g3log-performance-threaded_mean - ${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES}) + ${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES} ${PROFILER} ) # WORST CASE PERFORMANCE TEST add_executable(g3log-performance-threaded_worst @@ -43,7 +65,7 @@ set_target_properties(g3log-performance-threaded_worst PROPERTIES COMPILE_DEFINITIONS "G3LOG_PERFORMANCE=1") target_link_libraries(g3log-performance-threaded_worst - ${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES}) + ${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES} ${PROFILER}) ELSE() message( STATUS "-DADD_G3LOG_BENCH_PERFORMANCE=OFF" ) diff --git a/test_unit/Test.cmake b/test_unit/Test.cmake index d272af0..1c9eb16 100644 --- a/test_unit/Test.cmake +++ b/test_unit/Test.cmake @@ -18,6 +18,7 @@ # Unit test for g3log (cmake -DUSE_G3LOG_UNIT_TEST=ON ..) option (ADD_G3LOG_UNIT_TEST "g3log unit tests" ON) + message( STATUS "-DADD_G3LOG_UNIT_TEST=OFF" ) # 4. create the unit tests for g3log --- ONLY TESTED THE UNIT TEST ON LINUX @@ -52,7 +53,7 @@ enable_testing() set(DIR_UNIT_TEST ${g3log_SOURCE_DIR}/test_unit) - message( STATUS "-DADD_G3LOG_UNIT_TEST=ON" ) + # obs see this: http://stackoverflow.com/questions/9589192/how-do-i-change-the-number-of-template-arguments-supported-by-msvcs-stdtupl # and this: http://stackoverflow.com/questions/2257464/google-test-and-visual-studio-2010-rc