Project
Loading...
Searching...
No Matches
DecodingStat.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
14
15#include <bitset>
18#include "Framework/Logger.h"
19
20using namespace o2::itsmft;
21constexpr std::array<std::string_view, ChipStat::NErrorsDefined> ChipStat::ErrNames;
22
24uint32_t ChipStat::getNErrors() const
25{
26 uint32_t nerr = 0;
27 auto inner = [&](int errIdx) {
28 nerr += errorCounts[errIdx];
29 };
31 return nerr;
32}
33
37{
38 uint32_t res = 0;
39 if (d.getErrorFlags()) {
40 auto inner = [&](int errIdx) {
41 res |= ErrActions[errIdx] & ErrActPropagate;
42 if (verbosity > -1 && (!errorCounts[errIdx] || verbosity > 1)) {
43 LOGP(info,
44 "New error registered at bc/orbit {}/{} on the FEEID:{:#04x} "
45 "chip#{}: {}{}",
47 int16_t(d.getChipID()), ErrNames[errIdx],
48 d.getErrorDetails(errIdx));
49 res |= ErrActions[errIdx] & ErrActDump;
50 }
51 errorCounts[errIdx]++;
52 };
53 d.forEachSetError(inner);
54 }
55 return res;
56}
57
60void ChipStat::print(bool skipNoErr, const std::string& pref) const
61{
62 uint32_t nErr = 0;
63 for (int i = NErrorsDefined; i--;) {
64 nErr += errorCounts[i];
65 }
66 if (!skipNoErr || nErr) {
67 std::string rep = fmt::format("{}#{:#04x} NHits: {} errors: {}", pref.c_str(), feeID, nHits, nErr);
68 for (int i = 0; i < NErrorsDefined; i++) {
69 if (!skipNoErr || errorCounts[i]) {
70 rep += fmt::format(" | Err.: {}: {}", ErrNames[i].data(), errorCounts[i]);
71 }
72 }
73 LOG(info) << rep;
74 }
75}
76
79void GBTLinkDecodingStat::print(bool skipNoErr) const
80{
81 int nErr = 0;
82 for (int i = NErrorsDefined; i--;) {
83 nErr += errorCounts[i];
84 }
85 if (!skipNoErr || nErr) {
86 std::string rep = fmt::format("FEEID#{:#04x} Packet States Statistics (total packets: {}, triggers: {})", feeID, nPackets, nTriggers);
87 bool countsSeen = false;
88 for (int i = 0; i < GBTDataTrailer::MaxStateCombinations; i++) {
89 if (packetStates[i]) {
90 if (!countsSeen) {
91 countsSeen = true;
92 rep += " | counts for triggers: ";
93 } else {
94 rep += ", ";
95 }
96 std::bitset<GBTDataTrailer::NStatesDefined> patt(i);
97 rep += fmt::format("b{:s}: {}", patt.to_string().c_str(), packetStates[i]);
98 }
99 }
100 rep += fmt::format(" | Decoding errors: {}", nErr);
101 for (int i = 0; i < NErrorsDefined; i++) {
102 if (!skipNoErr || errorCounts[i]) {
103 rep += fmt::format(" [{}: {}]", ErrNames[i].data(), errorCounts[i]);
104 }
105 }
106 LOG(info) << rep;
107 }
108}
#define verbosity
Alpide Chip and GBT link decoding statistics.
int32_t i
Transient data classes for single pixel and set of pixels from current chip.
uint32_t res
Definition RawData.h:0
const o2::InteractionRecord & getInteractionRecord() const
Definition PixelData.h:113
auto getErrorFlags() const
Definition PixelData.h:131
std::string getErrorDetails(int pos) const
Definition PixelData.cxx:42
uint16_t getChipID() const
Definition PixelData.h:108
void forEachSetError(Func f) const
Definition PixelData.h:247
GLboolean * data
Definition glcorearb.h:298
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
static constexpr std::array< uint32_t, NErrorsDefined > ErrActions
uint32_t addErrors(const ChipPixelData &d, int verbosity)
void print(bool skipNoErr=true, const std::string &pref="FEEID") const
static constexpr std::array< std::string_view, NErrorsDefined > ErrNames
std::array< uint32_t, NErrorsDefined > errorCounts
static void forEachError(Func f)
uint32_t getNErrors() const
void print(bool skipNoErr=true) const
std::array< uint32_t, GBTDataTrailer::MaxStateCombinations > packetStates
static constexpr std::array< std::string_view, NErrorsDefined > ErrNames
std::array< uint32_t, NErrorsDefined > errorCounts
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"