Implemented gperftools support
it allows you to profile cpu/memory under unix systems
This commit is contained in:
parent
693dc56bf1
commit
b522a0cb72
5 changed files with 67 additions and 0 deletions
|
|
@ -75,6 +75,11 @@ if( UNIX )
|
||||||
find_package(Readline)
|
find_package(Readline)
|
||||||
find_package(ZLIB)
|
find_package(ZLIB)
|
||||||
find_package(BZip2)
|
find_package(BZip2)
|
||||||
|
|
||||||
|
if ( WITH_PERFTOOLS )
|
||||||
|
find_package(Gperftools)
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT WITHOUT_GIT)
|
if(NOT WITHOUT_GIT)
|
||||||
|
|
|
||||||
|
|
@ -5,5 +5,6 @@ option(USE_SCRIPTPCH "Use precompiled headers when compiling scripts"
|
||||||
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
option(USE_COREPCH "Use precompiled headers when compiling servers" 1)
|
||||||
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
option(WITH_WARNINGS "Show all warnings during compile" 0)
|
||||||
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
|
option(WITH_COREDEBUG "Include additional debug-code in core" 0)
|
||||||
|
option(WITH_PERFTOOLS "Enable compilation with gperftools libraries included" 0)
|
||||||
option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0)
|
option(WITH_MESHEXTRACTOR "Build meshextractor (alpha)" 0)
|
||||||
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
|
option(WITHOUT_GIT "Disable the GIT testing routines" 0)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,51 @@
|
||||||
|
# Tries to find Gperftools.
|
||||||
|
#
|
||||||
|
# Usage of this module as follows:
|
||||||
|
#
|
||||||
|
# find_package(Gperftools)
|
||||||
|
#
|
||||||
|
# Variables used by this module, they can change the default behaviour and need
|
||||||
|
# to be set before calling find_package:
|
||||||
|
#
|
||||||
|
# Gperftools_ROOT_DIR Set this variable to the root installation of
|
||||||
|
# Gperftools if the module has problems finding
|
||||||
|
# the proper installation path.
|
||||||
|
#
|
||||||
|
# Variables defined by this module:
|
||||||
|
#
|
||||||
|
# GPERFTOOLS_FOUND System has Gperftools libs/headers
|
||||||
|
# GPERFTOOLS_LIBRARIES The Gperftools libraries (tcmalloc & profiler)
|
||||||
|
# GPERFTOOLS_INCLUDE_DIR The location of Gperftools headers
|
||||||
|
|
||||||
|
find_library(GPERFTOOLS_TCMALLOC
|
||||||
|
NAMES tcmalloc
|
||||||
|
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||||
|
|
||||||
|
find_library(GPERFTOOLS_PROFILER
|
||||||
|
NAMES profiler
|
||||||
|
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||||
|
|
||||||
|
find_library(GPERFTOOLS_TCMALLOC_AND_PROFILER
|
||||||
|
NAMES tcmalloc_and_profiler
|
||||||
|
HINTS ${Gperftools_ROOT_DIR}/lib)
|
||||||
|
|
||||||
|
find_path(GPERFTOOLS_INCLUDE_DIR
|
||||||
|
NAMES gperftools/heap-profiler.h
|
||||||
|
HINTS ${Gperftools_ROOT_DIR}/include)
|
||||||
|
|
||||||
|
set(GPERFTOOLS_LIBRARIES ${GPERFTOOLS_TCMALLOC_AND_PROFILER})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(
|
||||||
|
Gperftools
|
||||||
|
DEFAULT_MSG
|
||||||
|
GPERFTOOLS_LIBRARIES
|
||||||
|
GPERFTOOLS_INCLUDE_DIR)
|
||||||
|
|
||||||
|
mark_as_advanced(
|
||||||
|
Gperftools_ROOT_DIR
|
||||||
|
GPERFTOOLS_TCMALLOC
|
||||||
|
GPERFTOOLS_PROFILER
|
||||||
|
GPERFTOOLS_TCMALLOC_AND_PROFILER
|
||||||
|
GPERFTOOLS_LIBRARIES
|
||||||
|
GPERFTOOLS_INCLUDE_DIR)
|
||||||
|
|
@ -65,6 +65,15 @@ else()
|
||||||
message("* Use coreside debug : No (default)")
|
message("* Use coreside debug : No (default)")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if ( UNIX )
|
||||||
|
if( WITH_PERFTOOLS )
|
||||||
|
message("* Use unix gperftools : Yes")
|
||||||
|
add_definitions(-DPERF_TOOLS)
|
||||||
|
else()
|
||||||
|
message("* Use unix gperftools : No (default)")
|
||||||
|
endif()
|
||||||
|
endif( UNIX )
|
||||||
|
|
||||||
if( WIN32 )
|
if( WIN32 )
|
||||||
if( USE_MYSQL_SOURCES )
|
if( USE_MYSQL_SOURCES )
|
||||||
message("* Use MySQL sourcetree : Yes (default)")
|
message("* Use MySQL sourcetree : Yes (default)")
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,7 @@ target_link_libraries(worldserver
|
||||||
g3dlib
|
g3dlib
|
||||||
gsoap
|
gsoap
|
||||||
Detour
|
Detour
|
||||||
|
${GPERFTOOLS_LIBRARIES}
|
||||||
${JEMALLOC_LIBRARY}
|
${JEMALLOC_LIBRARY}
|
||||||
${READLINE_LIBRARY}
|
${READLINE_LIBRARY}
|
||||||
${TERMCAP_LIBRARY}
|
${TERMCAP_LIBRARY}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue