Project
Loading...
Searching...
No Matches
SpyService.cxx
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11#include "SpyService.h"
12#include <uv.h>
17#include "SpyServiceHelpers.h"
18
19#include <string>
20#include <string_view>
21
22namespace o2::framework
23{
25 : mRegistry{registry},
26 mDeviceState{deviceState}
27{
29}
30
32{
33 return new ServiceSpec{
34 .name = "spy",
35 .init = [](ServiceRegistryRef services, DeviceState& state, fair::mq::ProgOptions& options) -> ServiceHandle {
36 return ServiceHandle{TypeIdHelpers::uniqueId<SpyService>(), new SpyService(services, state)};
37 },
39 .preSendingMessages = [](ServiceRegistryRef registry, fair::mq::Parts& parts, ChannelIndex channelIndex) {
40 auto &spy = registry.get<SpyService>();
41 spy.parts = &parts;
42 spy.partsAlive = false;
43
44 auto loop = registry.get<DeviceState>().loop;
45 GuiRenderer* renderer = registry.get<SpyService>().renderer;
46
47 if (renderer->guiConnected && uv_now(loop) > spy.enableAfter) {
48 LOG(info) << "Sending Policy uv_run";
49 registry.get<SpyService>().partsAlive = true;
50 uv_run(loop, UV_RUN_DEFAULT);
51 } },
52 .postRenderGUI = [](ServiceRegistryRef registry) { SpyServiceHelpers::webGUI(registry); },
53 .kind = ServiceKind::Serial};
54};
55
56} // namespace o2::framework
benchmark::State & state
static void webGUI(ServiceRegistryRef registry)
SpyService(ServiceRegistryRef registry, DeviceState &deviceState)
fair::mq::Parts * parts
Definition SpyService.h:40
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
static ServiceConfigureCallback noConfiguration()
Running state information of a given device.
Definition DeviceState.h:34
std::string name
Name of the service.
auto create() -> ServiceSpec *final
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"