Skip to content

Commit 337346e

Browse files
awegrzynsawenzel
authored andcommitted
init
1 parent ec82836 commit 337346e

3 files changed

Lines changed: 64 additions & 0 deletions

File tree

Utilities/O2Device/include/O2Device/O2Device.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#include <FairMQDevice.h>
3232
#include "Headers/DataHeader.h"
33+
#include "Monitoring/MonitoringFactory.h"
3334
#include <stdexcept>
3435

3536
namespace o2 {
@@ -45,6 +46,23 @@ class O2Device : public FairMQDevice
4546
using FairMQDevice::FairMQDevice;
4647
~O2Device() override = default;
4748

49+
std::unique_ptr<o2::monitoring::Monitoring> monitoring;
50+
51+
o2::monitoring::Monitoring* GetMonitoring() {
52+
return monitoring.get();
53+
}
54+
55+
void InitTask() {
56+
std::string monitoringKey = "monitoring-url";
57+
//FairMQDevice::Init();
58+
//using o2::monitoring::MonitoringFactory;
59+
auto dupa = GetConfig()->Count(monitoringKey);
60+
/*monitoring->addBackend(MonitoringFactory::GetBackend(
61+
GetConfig()->CountGetValiue<std::string>("monitoring-url")
62+
));*/
63+
//}
64+
}
65+
4866
/// Here is how to add an annotated data part (with header);
4967
/// @param[in,out] parts is a reference to the message;
5068
/// @param[] incomingStack header block must be MOVED in (rvalue ref)

cmake/O2Dependencies.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ find_package(FairRoot REQUIRED)
3535
find_package(FairMQ REQUIRED)
3636
find_package(Protobuf REQUIRED)
3737
find_package(Configuration REQUIRED)
38+
find_package(Monitoring REQUIRED)
3839

3940
find_package(GLFW)
4041

@@ -163,9 +164,11 @@ o2_define_bucket(
163164
FairRoot::FairMQ
164165
pthread
165166
dl
167+
${Monitoring_LIBRARIES}
166168

167169
INCLUDE_DIRECTORIES
168170
${FAIRROOT_INCLUDE_DIR}
171+
${Monitoring_INCLUDE_DIRS}
169172
)
170173

171174
# a common bucket for the implementation of devices inherited

cmake/modules/FindMonitoring.cmake

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# - Tries to find the O2 Monitoring package (include dir and library)
2+
# Author: Barthelemy von Haller
3+
# Author: Adam Wegrzynek
4+
#
5+
#
6+
# This module will set the following non-cached variables:
7+
# Monitoring_FOUND - states whether Monitoring package has been found
8+
# Monitoring_INCLUDE_DIRS - Monitoring include directory
9+
# Monitoring_LIBRARIES - Monitoring library filepath
10+
# Monitoring_DEFINITIONS - Compiler definitions when comping code using Monitoring
11+
#
12+
# Also following cached variables, but not for general use, are defined:
13+
# MONITORING_INCLUDE_DIR
14+
# MONITORING_LIBRARY
15+
#
16+
# This module respects following variables:
17+
# Monitoring_ROOT - Installation root directory (otherwise it goes through LD_LIBRARY_PATH and ENV)
18+
19+
# Init
20+
include(FindPackageHandleStandardArgs)
21+
22+
# find includes
23+
find_path(MONITORING_INCLUDE_DIR Monitoring.h
24+
HINTS ${Monitoring_ROOT}/include ENV LD_LIBRARY_PATH PATH_SUFFIXES "../include/Monitoring" "../../include/Monitoring" )
25+
26+
# Remove the final "Monitoring"
27+
get_filename_component(MONITORING_INCLUDE_DIR ${MONITORING_INCLUDE_DIR} DIRECTORY)
28+
set(Monitoring_INCLUDE_DIRS ${MONITORING_INCLUDE_DIR})
29+
30+
# find library
31+
find_library(MONITORING_LIBRARY NAMES Monitoring HINTS ${Monitoring_ROOT}/lib ENV LD_LIBRARY_PATH)
32+
set(Monitoring_LIBRARIES ${MONITORING_LIBRARY})
33+
34+
# handle the QUIETLY and REQUIRED arguments and set Monitoring_FOUND to TRUE
35+
# if all listed variables are TRUE
36+
find_package_handle_standard_args(Monitoring "Monitoring could not be found. Set Monitoring_ROOT as root installation directory."
37+
MONITORING_LIBRARY MONITORING_INCLUDE_DIR)
38+
if(${Monitoring_FOUND})
39+
set(Monitoring_DEFINITIONS "")
40+
message(STATUS "Monitoring found : ${Monitoring_LIBRARIES}")
41+
endif()
42+
43+
mark_as_advanced(MONITORING_INCLUDE_DIR MONITORING_LIBRARY)

0 commit comments

Comments
 (0)