profiling update do not merge to master

This commit is contained in:
Kjell Hedström 2024-01-02 11:41:00 -07:00
parent 4c1194720a
commit 40c9aa5be2
4 changed files with 28 additions and 3 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -42,6 +42,8 @@
cmake_minimum_required(VERSION 3.2) cmake_minimum_required(VERSION 3.2)
project(g3log CXX) 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 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)

View File

@ -22,10 +22,32 @@
# ========================= # =========================
IF (ADD_G3LOG_BENCH_PERFORMANCE) IF (ADD_G3LOG_BENCH_PERFORMANCE)
set(DIR_PERFORMANCE ${g3log_SOURCE_DIR}/test_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" ) message( STATUS "-DADD_G3LOG_BENCH_PERFORMANCE=ON" )
include_directories (${DIR_PERFORMANCE}) 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 # MEAN PERFORMANCE TEST
add_executable(g3log-performance-threaded_mean add_executable(g3log-performance-threaded_mean
${DIR_PERFORMANCE}/main_threaded_mean.cpp ${DIR_PERFORMANCE}/main_threaded_mean.cpp
@ -34,7 +56,7 @@
set_target_properties(g3log-performance-threaded_mean PROPERTIES set_target_properties(g3log-performance-threaded_mean PROPERTIES
COMPILE_DEFINITIONS "G3LOG_PERFORMANCE=1") COMPILE_DEFINITIONS "G3LOG_PERFORMANCE=1")
target_link_libraries(g3log-performance-threaded_mean target_link_libraries(g3log-performance-threaded_mean
${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES}) ${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES} ${PROFILER} )
# WORST CASE PERFORMANCE TEST # WORST CASE PERFORMANCE TEST
add_executable(g3log-performance-threaded_worst add_executable(g3log-performance-threaded_worst
@ -43,7 +65,7 @@
set_target_properties(g3log-performance-threaded_worst PROPERTIES set_target_properties(g3log-performance-threaded_worst PROPERTIES
COMPILE_DEFINITIONS "G3LOG_PERFORMANCE=1") COMPILE_DEFINITIONS "G3LOG_PERFORMANCE=1")
target_link_libraries(g3log-performance-threaded_worst target_link_libraries(g3log-performance-threaded_worst
${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES}) ${G3LOG_LIBRARY} ${PLATFORM_LINK_LIBRIES} ${PROFILER})
ELSE() ELSE()
message( STATUS "-DADD_G3LOG_BENCH_PERFORMANCE=OFF" ) message( STATUS "-DADD_G3LOG_BENCH_PERFORMANCE=OFF" )

View File

@ -18,6 +18,7 @@
# Unit test for g3log (cmake -DUSE_G3LOG_UNIT_TEST=ON ..) # Unit test for g3log (cmake -DUSE_G3LOG_UNIT_TEST=ON ..)
option (ADD_G3LOG_UNIT_TEST "g3log unit tests" 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 # 4. create the unit tests for g3log --- ONLY TESTED THE UNIT TEST ON LINUX
@ -52,7 +53,7 @@
enable_testing() enable_testing()
set(DIR_UNIT_TEST ${g3log_SOURCE_DIR}/test_unit) 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 # 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 # and this: http://stackoverflow.com/questions/2257464/google-test-and-visual-studio-2010-rc