Project
Loading...
Searching...
No Matches
DecodedDataAggregatorSpec.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
16
18
19#include <chrono>
22#include <Framework/Logger.h>
23#include "Framework/Output.h"
24#include "Framework/Task.h"
27
28namespace of = o2::framework;
29
30namespace o2
31{
32namespace mid
33{
34
36{
37 public:
39 {
40 auto stop = [this]() {
41 double scaleFactor = (mNROFs == 0) ? 0. : 1.e6 / mNROFs;
42 LOG(info) << "Processing time / " << mNROFs << " ROFs: full: " << mTimer.count() * scaleFactor << " aggregating: " << mTimerAlgo.count() * scaleFactor << " us";
43 };
44 ic.services().get<of::CallbackService>().set<of::CallbackService::Id::Stop>(stop);
45 }
46
48 {
49 auto tStart = std::chrono::high_resolution_clock::now();
50
51 auto msg = pc.inputs().get("mid_decoded");
52 auto data = of::DataRefUtils::as<const ROBoard>(msg);
53
54 auto msgROF = pc.inputs().get("mid_decoded_rof");
55 auto inROFRecords = of::DataRefUtils::as<const ROFRecord>(msgROF);
56
57 auto tAlgoStart = std::chrono::high_resolution_clock::now();
58 mAggregator.process(data, inROFRecords);
59 mTimerAlgo += std::chrono::high_resolution_clock::now() - tAlgoStart;
60
61 for (o2::header::DataHeader::SubSpecificationType subSpec = 0; subSpec < 3; ++subSpec) {
62 EventType evtType = static_cast<EventType>(subSpec);
63 pc.outputs().snapshot(of::Output{o2::header::gDataOriginMID, "DATA", subSpec}, mAggregator.getData(evtType));
64 pc.outputs().snapshot(of::Output{o2::header::gDataOriginMID, "DATAROF", subSpec}, mAggregator.getROFRecords(evtType));
65 }
66
67 mTimer += std::chrono::high_resolution_clock::now() - tStart;
68 mNROFs += mAggregator.getROFRecords().size();
69 }
70
71 private:
72 DecodedDataAggregator mAggregator{};
73 std::chrono::duration<double> mTimer{0};
74 std::chrono::duration<double> mTimerAlgo{0};
75 unsigned int mNROFs{0};
76};
77
79{
80 std::vector<of::InputSpec> inputSpecs{of::InputSpec{"mid_decoded", header::gDataOriginMID, "DECODED"}, of::InputSpec{"mid_decoded_rof", header::gDataOriginMID, "DECODEDROF"}};
81 std::vector<of::OutputSpec> outputSpecs;
82 for (o2::header::DataHeader::SubSpecificationType subSpec = 0; subSpec < 3; ++subSpec) {
83 outputSpecs.emplace_back(of::OutputSpec{header::gDataOriginMID, "DATA", subSpec});
84 outputSpecs.emplace_back(of::OutputSpec{header::gDataOriginMID, "DATAROF", subSpec});
85 }
86
88 "MIDDecodedDataAggregator",
89 {inputSpecs},
90 {outputSpecs},
91 of::AlgorithmSpec{of::adaptFromTask<o2::mid::DecodedDataAggregatorDeviceDPL>()}};
92}
93} // namespace mid
94} // namespace o2
Strip pattern (aka digits)
Data processor spec for MID decoded data aggregator devices.
MID decoded raw data aggregator.
void snapshot(const Output &spec, T const &object)
ServiceRegistryRef services()
Definition InitContext.h:34
decltype(auto) get(R binding, int part=0) const
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
const std::vector< ROFRecord > & getROFRecords(EventType eventType=EventType::Standard)
Gets the vector of data RO frame records.
void process(gsl::span< const ROBoard > localBoards, gsl::span< const ROFRecord > rofRecords)
const std::vector< ColumnData > & getData(EventType eventType=EventType::Standard)
Gets the vector of data.
GLboolean * data
Definition glcorearb.h:298
constexpr o2::header::DataOrigin gDataOriginMID
Definition DataHeader.h:573
Defining PrimaryVertex explicitly as messageable.
Definition TFIDInfo.h:20
framework::DataProcessorSpec getDecodedDataAggregatorSpec()
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint32_t SubSpecificationType
Definition DataHeader.h:620
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
uint64_t const void const *restrict const msg
Definition x9.h:153