Skip to content

Commit ee78b66

Browse files
authored
Merge pull request #229 from sy-c/master
v2.14.1
2 parents 12792b7 + 39949e1 commit ee78b66

18 files changed

+860
-317
lines changed

CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror -Wall -Wextra -Wno-deprecated-de
3131
# -Wno-unused-variable -Wno-unused-parameter -Wno-unused-private-field
3232
# -g -O0
3333

34+
# ensure debug symbols always included
35+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
36+
3437
# by default, build optimized release code
3538
if(NOT CMAKE_BUILD_TYPE)
3639
set(CMAKE_BUILD_TYPE RelWithDebInfo)
@@ -71,6 +74,7 @@ find_package(Occ)
7174
find_package(BookkeepingApiCpp)
7275
find_package(ZMQ)
7376
find_package(MySQL)
77+
#find_package(gperftools)
7478

7579
# extract include directories from targets
7680
get_target_property(InfoLogger_INCLUDE_DIRS AliceO2::InfoLogger INTERFACE_INCLUDE_DIRECTORIES)
@@ -138,8 +142,14 @@ else ()
138142
message(STATUS "MySQL not found, corresponding features will be disabled.")
139143
endif()
140144

145+
# check Gperftools
146+
if(${gperftools_FOUND})
147+
message(STATUS "gperftools enabled")
148+
endif()
149+
150+
141151
# add flags to enable optional features in Readout, based on available dependencies
142-
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>)
143153

144154
# define include directories
145155
set(READOUT_INCLUDE_DIRS
@@ -179,6 +189,9 @@ if(MYSQL_FOUND)
179189
list(APPEND READOUT_INCLUDE_DIRS ${MYSQL_INCLUDE_DIRS})
180190
list(APPEND READOUT_LINK_LIBRARIES ${MYSQL_LIBRARIES})
181191
endif()
192+
if(gperftools_FOUND)
193+
list(APPEND READOUT_LINK_LIBRARIES ${gperftools_LIBRARIES})
194+
endif()
182195

183196
# some systems don't need an explicit library to have dlopen()
184197
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)

doc/releaseNotes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,3 +480,7 @@ This file describes the main feature changes for each readout.exe released versi
480480
## v2.13.0 - 11/08/2022
481481
- Updated configuration parameters:
482482
- added equipment-*.numaNode. If set, memory / thread will try to use given NUMA node. If "auto", will try to guess it for given equipment (eg ROC). "auto" is default.
483+
484+
## v2.14.1 - 22/08/2022
485+
- Updated configuration parameters:
486+
- added consumer-FairMQChannel-*.threads. If set, a pool of threads is used for FMQ message formatting. Needed at high rates when a single CPU core is not enough to prepare data for DataDistribution (including overlapping HBF copy).

src/Consumer.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414

1515
Consumer::Consumer(ConfigFile& cfg, std::string cfgEntryPoint)
1616
{
17+
// by default, name the equipment as the config node entry point
18+
// configuration parameter: | consumer-* | name | string| | Name used to identify this consumer (in logs). By default, it takes the name of the configuration section, consumer-xxx |
19+
cfg.getOptionalValue<std::string>(cfgEntryPoint + ".name", name, cfgEntryPoint);
20+
1721
// configuration parameter: | consumer-* | filterLinksInclude | string | | Defines a filter based on link ids. Only data belonging to the links in this list (coma separated values) are accepted. If empty, all link ids are fine. |
1822
std::string cfgFilterLinksInclude;
1923
cfg.getOptionalValue<std::string>(cfgEntryPoint + ".filterLinksInclude", cfgFilterLinksInclude);

src/Consumer.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class Consumer
4242
// Function called just after stopping data taking, after the last call to pushData(). Not called before input FIFO empty.
4343
virtual int stop()
4444
{
45-
theLog.log(LogInfoDevel_(3003), "Push statistics for %s: %llu err / %llu total (DataSets), %llu/%llu filtered (DataBlocks)", this->name.c_str(), totalPushError, totalPushError + totalPushSuccess, totalBlocksFiltered, totalBlocksUnfiltered + totalBlocksFiltered);
45+
theLog.log(LogInfoDevel_(3003), "Push statistics for %s: %llu err / %llu total (DataSets), %llu/%llu filtered (DataBlocks)",
46+
this->name.c_str(), totalPushError.load(), totalPushError.load() + totalPushSuccess.load(), totalBlocksFiltered.load(), totalBlocksUnfiltered.load() + totalBlocksFiltered.load());
4647
return 0;
4748
};
4849

@@ -53,10 +54,10 @@ class Consumer
5354
bool stopOnError = false; // if set, readout will stop when this consumer reports an error (isError flag or pushData() failing)
5455
int isError = 0; // flag which might be used to count number of errors occuring in the consumer
5556
bool isErrorReported = false; // flag to keep track of error reports for this consumer
56-
unsigned long long totalPushSuccess = 0;
57-
unsigned long long totalPushError = 0;
58-
unsigned long long totalBlocksFiltered = 0;
59-
unsigned long long totalBlocksUnfiltered = 0;
57+
std::atomic<unsigned long long> totalPushSuccess = 0;
58+
std::atomic<unsigned long long> totalPushError = 0;
59+
std::atomic<unsigned long long> totalBlocksFiltered = 0;
60+
std::atomic<unsigned long long> totalBlocksUnfiltered = 0;
6061

6162
protected:
6263
// check if a DataBlock passes defined filters. Return 1 if ok, zero if not.

0 commit comments

Comments
 (0)