Project
Loading...
Searching...
No Matches
StreamContext.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
13
14#include "Framework/Signpost.h"
15
16O2_DECLARE_DYNAMIC_LOG(stream_context);
17
18namespace o2::framework
19{
20
22{
23 for (auto& handle : preStartStreamHandles) {
24 LOG(detail) << "Invoking preStartStreamCallbacks for " << handle.spec.name;
25 assert(handle.callback);
26 // The service must be nullptr because we have not created it yet at this
27 // point.
28 handle.callback(ref, nullptr);
29 }
30}
33{
34 O2_SIGNPOST_ID_FROM_POINTER(dpid, stream_context, &pcx);
35 O2_SIGNPOST_START(stream_context, dpid, "callbacks", "Starting StreamContext preProcessingCallbacks");
36 for (auto& handle : preProcessingHandles) {
37 O2_SIGNPOST_ID_FROM_POINTER(cid, stream_context, handle.service);
38 O2_SIGNPOST_START(stream_context, cid, "callbacks", "Starting StreamContext::preProcessingCallbacks for service %{public}s", handle.spec.name.c_str());
39 assert(handle.service);
40 assert(handle.callback);
41 handle.callback(pcx, handle.service);
42 O2_SIGNPOST_END(stream_context, cid, "callbacks", "Ending StreamContext::preProcessingCallbacks for service %{public}s", handle.spec.name.c_str());
43 }
44 O2_SIGNPOST_END(stream_context, dpid, "callbacks", "Ending StreamContext preProcessingCallbacks");
45}
46
49{
50 for (auto& handle : finaliseOutputsHandles) {
51 LOG(debug) << "Invoking finaliseOutputsCallbacks for " << handle.service;
52 assert(handle.service);
53 assert(handle.callback);
54 handle.callback(pcx, handle.service);
55 }
56}
57
60{
61 O2_SIGNPOST_ID_FROM_POINTER(dpid, stream_context, &pcx);
62 O2_SIGNPOST_START(stream_context, dpid, "callbacks", "Starting StreamContext postProcessingCallbacks");
63 for (auto& handle : postProcessingHandles) {
64 O2_SIGNPOST_ID_FROM_POINTER(cid, stream_context, handle.service);
65 O2_SIGNPOST_START(stream_context, cid, "callbacks", "Starting StreamContext::postProcessingCallbacks for service %{public}s", handle.spec.name.c_str());
66 assert(handle.service);
67 assert(handle.callback);
68 handle.callback(pcx, handle.service);
69 O2_SIGNPOST_END(stream_context, cid, "callbacks", "Ending StreamContext::postProcessingCallbacks for service %{public}s", handle.spec.name.c_str());
70 }
71 O2_SIGNPOST_END(stream_context, dpid, "callbacks", "Ending StreamContext postProcessingCallbacks");
72}
73
76{
77 for (auto& eosHandle : preEOSHandles) {
78 LOG(detail) << "Invoking preEOSCallbacks for" << eosHandle.service;
79 assert(eosHandle.service);
80 assert(eosHandle.callback);
81 eosHandle.callback(eosContext, eosHandle.service);
82 }
83}
84
87{
88 for (auto& eosHandle : postEOSHandles) {
89 LOG(detail) << "Invoking postEOSCallbacks for " << eosHandle.service;
90 assert(eosHandle.service);
91 assert(eosHandle.callback);
92 eosHandle.callback(eosContext, eosHandle.service);
93 }
94}
95
96} // namespace o2::framework
#define O2_DECLARE_DYNAMIC_LOG(name)
Definition Signpost.h:473
#define O2_SIGNPOST_ID_FROM_POINTER(name, log, pointer)
Definition Signpost.h:489
#define O2_SIGNPOST_END(log, id, name, format,...)
Definition Signpost.h:540
#define O2_SIGNPOST_START(log, id, name, format,...)
Definition Signpost.h:534
std::ostringstream debug
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
std::vector< ServiceProcessingHandle > postProcessingHandles
Callbacks for services to be executed after every process method invokation.
void finaliseOutputsCallbacks(ProcessingContext &)
Invoke callbacks to be executed after every process method invokation.
void preProcessingCallbacks(ProcessingContext &pcx)
Invoke callbacks to be executed before every process method invokation.
void preEOSCallbacks(EndOfStreamContext &eosContext)
Invoke callbacks to be executed before every EOS user callback invokation.
std::vector< ServiceStartStreamHandle > preStartStreamHandles
std::vector< ServiceProcessingHandle > finaliseOutputsHandles
void postProcessingCallbacks(ProcessingContext &pcx)
Invoke callbacks to be executed after every process method invokation.
std::vector< ServiceEOSHandle > postEOSHandles
Callbacks for services to be executed after every EOS user callback invokation.
void preStartStreamCallbacks(ServiceRegistryRef)
std::vector< ServiceEOSHandle > preEOSHandles
Callbacks for services to be executed before every EOS user callback invokation.
void postEOSCallbacks(EndOfStreamContext &eosContext)
Invoke callbacks to be executed after every EOS user callback invokation.
std::vector< ServiceProcessingHandle > preProcessingHandles
Callbacks for services to be executed before every process method invokation.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"