Skip to content

Commit e22de7b

Browse files
authored
Merge pull request #10 from sy-c/master
updating latest features
2 parents eb656e7 + a425941 commit e22de7b

File tree

5 files changed

+46
-8
lines changed

5 files changed

+46
-8
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ include_directories(
6868
${Monitoring_INCLUDE_DIRS}
6969
${FAIRROOT_INCLUDE_DIR}
7070
${FAIRROOT_INCLUDE_DIR}/fairmq
71-
# ${ZeroMQ_INCLUDE_DIR}
71+
${ZeroMQ_INCLUDE_DIR}
7272
${Common_INCLUDE_DIRS}
7373
${Configuration_INCLUDE_DIRS}
7474
${InfoLogger_INCLUDE_DIRS}
@@ -142,6 +142,7 @@ O2_GENERATE_EXECUTABLE(
142142
BUCKET_NAME ${BUCKET_NAME}
143143
)
144144

145+
if (FAIRROOT_FOUND)
145146
O2_GENERATE_EXECUTABLE(
146147
EXE_NAME testTxFMQ.exe
147148
SOURCES src/testTxFMQ.cxx $<TARGET_OBJECTS:objReadoutUtils>
@@ -153,6 +154,7 @@ O2_GENERATE_EXECUTABLE(
153154
SOURCES src/testRxFMQ.cxx $<TARGET_OBJECTS:objReadoutUtils>
154155
BUCKET_NAME ${BUCKET_NAME}
155156
)
157+
endif ()
156158

157159
O2_GENERATE_EXECUTABLE(
158160
EXE_NAME readRaw.exe
@@ -166,6 +168,12 @@ O2_GENERATE_EXECUTABLE(
166168
BUCKET_NAME ${BUCKET_NAME}
167169
)
168170

171+
O2_GENERATE_EXECUTABLE(
172+
EXE_NAME testMonitor.exe
173+
SOURCES src/testMonitor.cxx
174+
BUCKET_NAME ${BUCKET_NAME}
175+
)
176+
169177
# Install some extra files
170178
install(
171179
FILES readout.cfg

cmake/ReadoutDependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ find_package(Common REQUIRED)
77
find_package(InfoLogger REQUIRED)
88
find_package(ReadoutCard REQUIRED)
99
find_package(DataSampling REQUIRED)
10-
#find_package(ZeroMQ REQUIRED)
10+
find_package(ZeroMQ REQUIRED)
1111
find_package(Numa)
1212

1313
if (FAIRROOT_FOUND)

src/ConsumerStats.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ class ConsumerStats: public Consumer {
8989
// https://alice.its.cern.ch/jira/browse/FLPPROT-69
9090

9191
monitoringCollector->send({counterBlocks, "readout.Blocks"});
92+
monitoringCollector->send({counterBytesTotal, "readout.BytesTotal"});
9293
monitoringCollector->send({counterBytesTotal, "readout.BytesTotal"}, DerivedMetricMode::RATE);
9394
monitoringCollector->send({counterBytesDiff, "readout.BytesInterval"});
9495
// monitoringCollector->send({(counterBytesTotal/(1024*1024)), "readout.MegaBytesTotal"});

src/mainReadout.cxx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -339,10 +339,11 @@ int main(int argc, char* argv[])
339339
theLog.log("Creating aggregator");
340340
AliceO2::Common::Fifo<DataSetReference> agg_output(1000);
341341
int nEquipmentsAggregated=0;
342-
DataBlockAggregator agg(&agg_output,"Aggregator");
342+
auto agg=std::make_unique<DataBlockAggregator>(&agg_output,"Aggregator");
343+
343344
for (auto && readoutDevice : readoutDevices) {
344345
//theLog.log("Adding equipment: %s",readoutDevice->getName().c_str());
345-
agg.addInput(readoutDevice->dataOut);
346+
agg->addInput(readoutDevice->dataOut);
346347
nEquipmentsAggregated++;
347348
}
348349
theLog.log("Aggregator: %d equipments", nEquipmentsAggregated);
@@ -368,7 +369,7 @@ int main(int argc, char* argv[])
368369

369370

370371
theLog.log("Starting aggregator");
371-
agg.start();
372+
agg->start();
372373

373374
// notify consumers of imminent data flow start
374375
for (auto& c : dataConsumers) {
@@ -450,14 +451,15 @@ int main(int argc, char* argv[])
450451

451452

452453
theLog.log("Stopping aggregator");
453-
agg.stop();
454+
agg->stop();
454455

455456
theLog.log("Stopping consumers");
456457
// close consumers before closing readout equipments (owner of data blocks)
457458
dataConsumers.clear();
458459

459460
agg_output.clear();
460-
461+
agg=nullptr; // destroy aggregator, and release blocks it may still own.
462+
461463
// todo: check nothing in the input pipeline
462464
// flush & stop equipments
463465
for (auto && readoutDevice : readoutDevices) {
@@ -472,7 +474,7 @@ int main(int argc, char* argv[])
472474
for (size_t i = 0, size = readoutDevices.size(); i != size; ++i) {
473475
readoutDevices[i]=nullptr; // effectively deletes the device
474476
}
475-
readoutDevices.clear(); // to do it all in one go
477+
//readoutDevices.clear(); // to do it all in one go
476478

477479
if (latencyFd>=0) {
478480
close(latencyFd);

src/testMonitor.cxx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// simple test program used to evaluate overhead of monitoring lib
2+
3+
#include <stdint.h>
4+
#include <stdio.h>
5+
6+
#include <Monitoring/MonitoringFactory.h>
7+
using namespace o2::monitoring;
8+
9+
int main() {
10+
11+
std::unique_ptr<Monitoring> monitoringCollector;
12+
monitoringCollector=MonitoringFactory::Get("influxdb-udp://aido2mon-gpn.cern.ch:8088");
13+
monitoringCollector->enableProcessMonitoring(1);
14+
15+
uint64_t bytesTotal=0;
16+
17+
for(;;){
18+
bytesTotal+=1000000000;
19+
monitoringCollector->send({bytesTotal, "readout.BytesTotal"});
20+
monitoringCollector->send({bytesTotal, "readout.BytesTotal"}, DerivedMetricMode::RATE);
21+
printf(".");
22+
fflush(stdout);
23+
sleep(1);
24+
}
25+
26+
return 0;
27+
}

0 commit comments

Comments
 (0)