Project
Loading...
Searching...
No Matches
test_SimpleTimer.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.
15
16#include <chrono>
17#include <thread>
18
19using namespace o2::framework;
20
21// This is how you can define your processing in a declarative way
22std::vector<DataProcessorSpec> defineDataProcessing(ConfigContext const&)
23{
24 return {
26 "enumeration",
27 Inputs{},
28 {},
30 adaptStateless([](ControlService& control) {
31 // This is invoked autonomously by the timer.
32 std::this_thread::sleep_for(std::chrono::seconds(1));
33 control.readyToQuit(QuitRequest::All);
34 })}},
36 "atimer",
37 Inputs{
38 InputSpec{"atimer", "TST", "TIMER", 0, Lifetime::Timer}},
39 {},
41 adaptStateless([](ControlService& control, InputRecord& inputs) {
42 DataRef ref = inputs.get("atimer");
43 auto* header = o2::header::get<o2::header::DataHeader*>(ref.header);
44 LOG(info) << "Run number: " << header->runNumber;
45 // This is invoked autonomously by the timer.
46 control.readyToQuit(QuitRequest::Me);
47 })}},
49 "btimer",
50 Inputs{
51 InputSpec{"btimer", "TST", "TIMER2", 0, Lifetime::Timer}},
52 {},
54 adaptStateless([](ControlService& control) {
55 // This is invoked autonomously by the timer.
56 control.readyToQuit(QuitRequest::Me);
57 })},
58 {ConfigParamSpec{"period-btimer", VariantType::Int, 2000, {"period of timer"}}}}};
59}
std::vector< std::string > header
void readyToQuit(bool all)
Compatibility with old API.
The input API of the Data Processing Layer This class holds the inputs which are valid for processing...
decltype(auto) get(R binding, int part=0) const
GLint ref
Definition glcorearb.h:291
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
AlgorithmSpec::ProcessCallback adaptStateless(LAMBDA l)
std::vector< InputSpec > Inputs
std::vector< DataProcessorSpec > defineDataProcessing(ConfigContext const &)
This function hooks up the the workflow specifications into the DPL driver.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"