Project
Loading...
Searching...
No Matches
o2FairMQHeaderSizeTest.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
17
18
#include "
Framework/ConfigParamSpec.h
"
19
#include "
Framework/ControlService.h
"
20
#include "
Framework/CallbackService.h
"
21
#include "
Framework/EndOfStreamContext.h
"
22
#include "
Framework/DeviceSpec.h
"
23
#include "
Framework/ControlService.h
"
24
#include "
Framework/runDataProcessing.h
"
25
26
#include <chrono>
27
#include <thread>
28
#include <vector>
29
#include <random>
30
31
using namespace
o2::framework
;
32
33
static
std::random_device
rd
;
34
static
std::mt19937
gen
(
rd
());
35
36
std::string
random_string
(
size_t
length
)
37
{
38
static
const
char
alphanum[] =
39
"0123456789"
40
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
41
"abcdefghijklmnopqrstuvwxyz"
;
42
43
std::uniform_int_distribution<> dis(0,
sizeof
(alphanum) - 2);
44
45
std::string randomString;
46
randomString.reserve(
length
);
47
48
for
(
int
i
= 0;
i
<
length
; ++
i
) {
49
randomString.push_back(alphanum[dis(
gen
)]);
50
}
51
52
return
randomString;
53
}
54
55
std::string
filename
()
56
{
57
std::stringstream ss;
58
ss <<
"messages_count_"
<<
random_string
(10) <<
".data"
;
59
return
std::move(ss).str();
60
}
61
62
WorkflowSpec
defineDataProcessing
(
ConfigContext
const
& specs)
63
{
64
return
WorkflowSpec
{
65
{
"A"
,
66
Inputs
{},
67
{
OutputSpec
{{
"a"
},
"TST"
,
"A"
}},
68
AlgorithmSpec
{
69
[numberOfMessages = 0,
filename
=
filename
()](
ProcessingContext
& ctx)
mutable
{
70
using namespace
std::chrono;
71
++numberOfMessages;
72
// LOG(info) << "Generating message #" << ++numberOfMessages;
73
74
{
75
auto
file
= std::ofstream(
filename
, std::ios_base::out | std::ios_base::trunc);
76
// file << duration_cast<milliseconds>(system_clock::now().time_since_epoch()).count() << "," << numberOfMessages << "\n";
77
file
<< numberOfMessages;
78
}
79
80
auto
& aData = ctx.outputs().make<
int
>(
Output
{
"TST"
,
"A"
, 0}, 1);
81
aData[0] = 1;
82
}}},
83
{
"B"
,
84
{
InputSpec
{
"x"
,
"TST"
,
"A"
}},
85
Outputs
{},
86
AlgorithmSpec
{[](
InitContext
& ic) {
87
return
[](
ProcessingContext
& ctx) {
88
while
(
true
) {
89
std::this_thread::sleep_for(std::chrono::milliseconds{100});
90
}
91
// auto& data = ctx.inputs().get<int>("x");
92
// LOG(info) << "Reading message: " << data;
93
};
94
}}},
95
};
96
}
CallbackService.h
ConfigParamSpec.h
ControlService.h
gen
default_random_engine gen(dev())
DeviceSpec.h
EndOfStreamContext.h
i
int32_t i
Definition
GPUCommonAlgorithm.h:443
o2::framework::ConfigContext
Definition
ConfigContext.h:24
o2::framework::InitContext
Definition
InitContext.h:25
o2::framework::ProcessingContext
Definition
ProcessingContext.h:27
length
GLuint GLsizei GLsizei * length
Definition
glcorearb.h:790
o2::framework
Defining PrimaryVertex explicitly as messageable.
Definition
TFIDInfo.h:20
o2::framework::WorkflowSpec
std::vector< DataProcessorSpec > WorkflowSpec
Definition
HBFUtilsInitializer.h:39
o2::framework::Inputs
std::vector< InputSpec > Inputs
Definition
DataProcessorSpec.h:29
o2::framework::Outputs
std::vector< OutputSpec > Outputs
Definition
DataProcessorSpec.h:30
defineDataProcessing
WorkflowSpec defineDataProcessing(ConfigContext const &specs)
This function hooks up the the workflow specifications into the DPL driver.
Definition
o2FairMQHeaderSizeTest.cxx:62
random_string
std::string random_string(size_t length)
Definition
o2FairMQHeaderSizeTest.cxx:36
filename
std::string filename()
Definition
o2FairMQHeaderSizeTest.cxx:55
runDataProcessing.h
file
const char * file
Definition
standalone-cluster-dump-entropy-analysed.cxx:52
o2::framework::AlgorithmSpec
Definition
AlgorithmSpec.h:43
o2::framework::InputSpec
Definition
InputSpec.h:31
o2::framework::OutputSpec
Definition
OutputSpec.h:33
o2::framework::Output
Definition
Output.h:27
rd
std::random_device rd
Definition
test_ctf_io_ctp.cxx:45
Framework
TestWorkflows
src
o2FairMQHeaderSizeTest.cxx
Generated on Tue Feb 25 2025 17:03:22 for Project by
1.9.8