Skip to content

Commit 8f160e7

Browse files
committed
added gperfools profiling
1 parent 530eaf5 commit 8f160e7

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

CMakeLists.txt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ find_package(Occ)
7474
find_package(BookkeepingApiCpp)
7575
find_package(ZMQ)
7676
find_package(MySQL)
77+
#find_package(gperftools)
7778

7879
# extract include directories from targets
7980
get_target_property(InfoLogger_INCLUDE_DIRS AliceO2::InfoLogger INTERFACE_INCLUDE_DIRECTORIES)
@@ -141,8 +142,14 @@ else ()
141142
message(STATUS "MySQL not found, corresponding features will be disabled.")
142143
endif()
143144

145+
# check Gperftools
146+
if(${gperftools_FOUND})
147+
message(STATUS "gperftools enabled")
148+
endif()
149+
150+
144151
# add flags to enable optional features in Readout, based on available dependencies
145-
add_compile_definitions($<$<BOOL:${Numa_FOUND}>:WITH_NUMA> $<$<BOOL:${RDMA_FOUND}>:WITH_RDMA> $<$<BOOL:${Configuration_FOUND}>:WITH_CONFIG> $<$<BOOL:${FairMQ_FOUND}>:WITH_FAIRMQ> $<$<BOOL:${Occ_FOUND}>:WITH_OCC> $<$<BOOL:${BookkeepingApiCpp_FOUND}>:WITH_LOGBOOK> $<$<BOOL:${ZMQ_FOUND}>:WITH_ZMQ> $<$<BOOL:${MYSQL_FOUND}>:WITH_DB> $<$<BOOL:${ReadoutCard_FOUND}>:WITH_READOUTCARD> )
152+
add_compile_definitions($<$<BOOL:${Numa_FOUND}>:WITH_NUMA> $<$<BOOL:${RDMA_FOUND}>:WITH_RDMA> $<$<BOOL:${Configuration_FOUND}>:WITH_CONFIG> $<$<BOOL:${FairMQ_FOUND}>:WITH_FAIRMQ> $<$<BOOL:${Occ_FOUND}>:WITH_OCC> $<$<BOOL:${BookkeepingApiCpp_FOUND}>:WITH_LOGBOOK> $<$<BOOL:${ZMQ_FOUND}>:WITH_ZMQ> $<$<BOOL:${MYSQL_FOUND}>:WITH_DB> $<$<BOOL:${ReadoutCard_FOUND}>:WITH_READOUTCARD> $<$<BOOL:${gperftools_FOUND}>:WITH_GPERFTOOLS>)
146153

147154
# define include directories
148155
set(READOUT_INCLUDE_DIRS
@@ -182,6 +189,9 @@ if(MYSQL_FOUND)
182189
list(APPEND READOUT_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS})
183190
list(APPEND READOUT_LINK_LIBRARIES ${MYSQL_LIBRARIES})
184191
endif()
192+
if(gperftools_FOUND)
193+
list(APPEND READOUT_LINK_LIBRARIES ${gperftools_LIBRARIES})
194+
endif()
185195

186196
# some systems don't need an explicit library to have dlopen()
187197
if (CMAKE_DL_LIBS)

cmake/Findgperftools.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Try to find the gperftools package include dirs and libraries
2+
# Author: Sylvain Chapeland
3+
#
4+
# This script will set the following variables:
5+
# gperftools_FOUND - System has gperftools
6+
# gperftools_INCLUDE_DIRS - The gperftools include directories
7+
# gperftools_LIBRARIES - The libraries needed to use gperftools
8+
#
9+
# This script can use the following variables:
10+
# gperftools_ROOT - Installation root to tell this module where to look.
11+
12+
13+
find_path(
14+
gperftools_INCLUDE_DIRS NAMES gperftools/profiler.h
15+
PATHS ${gperftools_ROOT} ${gperftools_ROOT}/include)
16+
17+
find_library(
18+
gperftools_LIBRARIES NAMES profiler tcmalloc
19+
PATHS ${gperftools_ROOT} ${gperftools_ROOT}/lib)
20+
21+
include(FindPackageHandleStandardArgs)
22+
find_package_handle_standard_args(
23+
gperftools DEFAULT_MSG gperftools_INCLUDE_DIRS gperftools_LIBRARIES)
24+
25+
if(${gperftools_FOUND})
26+
message(
27+
STATUS
28+
"Found gperftools (include: ${gperftools_INCLUDE_DIRS} library: ${gperftools_LIBRARIES})")
29+
endif()
30+
31+
mark_as_advanced(gperftools_INCLUDE_DIRS gperftools_LIBRARIES)

0 commit comments

Comments
 (0)