Project
Loading...
Searching...
No Matches
DeviceStateHelpers.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
12#include "DeviceStateHelpers.h"
14#include <string_view>
15#include <cstring>
16
17namespace o2::framework
18{
19
21{
22 if (reason == "NO_REASON") {
24 } else if (reason == "METRICS_MUST_FLUSH") {
26 } else if (reason == "SIGNAL_ARRIVED") {
28 } else if (reason == "DATA_SOCKET_POLLED") {
30 } else if (reason == "DATA_INCOMING") {
32 } else if (reason == "DATA_OUTGOING") {
34 } else if (reason == "WS_COMMUNICATION") {
36 } else if (reason == "TIMER_EXPIRED") {
38 } else if (reason == "WS_CONNECTED") {
40 } else if (reason == "WS_CLOSING") {
42 } else if (reason == "WS_READING") {
44 } else if (reason == "WS_WRITING") {
46 } else if (reason == "ASYNC_NOTIFICATION") {
48 } else if (reason == "OOB_ACTIVITY") {
50 } else if (reason == "UNKNOWN") {
52 } else if (reason == "FIRST_LOOP") {
54 } else if (reason == "NEW_STATE_PENDING") {
56 } else if (reason == "PREVIOUSLY_ACTIVE") {
58 } else if (reason == "TRACE_CALLBACKS") {
60 } else if (reason == "TRACE_USERCODE") {
62 } else {
64 }
65}
66
68{
69 // split string by pipe and convert to int based
70 // on the LoopReason enum
71 std::vector<std::string_view> tokens;
72 char const* first = s.c_str();
73 char const* last = s.c_str();
74
75 while (true) {
76 char const* next = std::strchr(last, '|');
77 if (next) {
78 tokens.emplace_back(first, next - first);
79 first = next + 1;
80 last = first;
81 } else {
82 tokens.emplace_back(first, s.size() - (first - s.c_str()));
83 break;
84 }
85 }
86 int ret = 0;
87 for (auto const& token : tokens) {
88 ret |= static_cast<int>(loopReasonFromString(token));
89 }
90 return ret;
91}
92} // namespace o2::framework
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
GLint first
Definition glcorearb.h:399
Defining ITS Vertex explicitly as messageable.
Definition Cartesian.h:288
DeviceState::LoopReason loopReasonFromString(std::string_view reason)
static int parseTracingFlags(std::string const &events)
LoopReason
Motivation for the loop being triggered.
Definition DeviceState.h:36