Skip to content

Commit ca78e0b

Browse files
committed
[bench-dma] Include orbit and bunch crossing in error reporting
1 parent 6bce687 commit ca78e0b

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,15 @@ class ProgramDmaBench : public Program
713713
// Get memsize from the header
714714
const auto memBytes = DataFormat::getMemsize(reinterpret_cast<const char*>(pageAddress)); // Memory size [RDH, Payload]
715715

716+
// It is useful to also report the orbit and the bunch crossing on error
717+
const auto orbit = DataFormat::getOrbit(reinterpret_cast<const char*>(pageAddress));
718+
const auto bunchCrossing = DataFormat::getBunchCrossing(reinterpret_cast<const char*>(pageAddress));
719+
716720
if (memBytes < 0x40 || memBytes > pageSize) {
717721
// Report RDH error
718722
mErrorCount++;
719723
if (mErrorCount < MAX_RECORDED_ERRORS) {
720-
mErrorStream << b::format("[RDHERR]\tevent:%1% l:%2% payloadBytes:%3% size:%4% words out of range\n") % eventNumber % linkId % memBytes % pageSize;
724+
mErrorStream << b::format("[RDHERR]\tevent:%d l:%d o:0x%x bc:0x%x payloadBytes:%d size:%d words out of range\n") % eventNumber % linkId % orbit % bunchCrossing % memBytes % pageSize;
721725
}
722726
return true;
723727
}
@@ -727,15 +731,15 @@ class ProgramDmaBench : public Program
727731

728732
if (mPacketCounters[linkId] == PACKET_COUNTER_INITIAL_VALUE) {
729733
if (mErrorCount < MAX_RECORDED_ERRORS) {
730-
mErrorStream << b::format("resync packet counter for e:%d l:%d packet_cnt:%x mpacket_cnt:%x le:%d \n") % eventNumber % linkId % packetCounter %
734+
mErrorStream << b::format("resync packet counter for e:%d l:%d o:0x%x bc:0x%x packet_cnt:0x%x mpacket_cnt:0x%x le:%d \n") % eventNumber % linkId % orbit % bunchCrossing % packetCounter %
731735
mPacketCounters[linkId] % mEventCounters[linkId];
732736
}
733737
mPacketCounters[linkId] = packetCounter;
734738
} else if (((mPacketCounters[linkId] + mErrorCheckFrequency) % (mMaxRdhPacketCounter + 1)) != packetCounter) { //packetCounter is 8bits long
735739
// log packet counter error
736740
mErrorCount++;
737741
if (mErrorCount < MAX_RECORDED_ERRORS) {
738-
mErrorStream << b::format("[RDHERR]\tevent:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% mpacket_cnt:%6% levent:%7% unexpected packet counter\n") % eventNumber % linkId % memBytes % pageSize % packetCounter % mPacketCounters[linkId] % mEventCounters[linkId];
742+
mErrorStream << b::format("[RDHERR]\tevent:%d l:%d o:0x%x bc: 0x%x payloadBytes:%d size:%d packet_cnt:0x%x mpacket_cnt:0x%x levent:%d unexpected packet counter\n") % eventNumber % linkId % orbit % bunchCrossing % memBytes % pageSize % packetCounter % mPacketCounters[linkId] % mEventCounters[linkId];
739743
}
740744
return true;
741745
} else {
@@ -746,7 +750,7 @@ class ProgramDmaBench : public Program
746750
// log TF not at the beginning of the superpage error
747751
mErrorCount++;
748752
if (mErrorCount < MAX_RECORDED_ERRORS) {
749-
mErrorStream << b::format("[RDHERR]\tevent:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% orbit:%6$#x nextTForbit:%7$#x atSPStart:%8% TF unaligned w/ start of superpage\n") % eventNumber % linkId % memBytes % pageSize % packetCounter % mOrbit % mNextTFOrbit % atStartOfSuperpage;
753+
mErrorStream << b::format("[RDHERR]\tevent:%d l:%d o:0x%x bc:0x%x payloadBytes:%d size:%d packet_cnt:0x%x nextTForbit:0x%x atSPStart:%b TF unaligned w/ start of superpage\n") % eventNumber % linkId % orbit % bunchCrossing % memBytes % pageSize % packetCounter % mNextTFOrbit % atStartOfSuperpage;
750754
}
751755
}
752756

@@ -847,10 +851,15 @@ class ProgramDmaBench : public Program
847851
bool checkErrorsCrorc(uintptr_t pageAddress, size_t pageSize, int64_t eventNumber, int linkId, bool atStartOfSuperpage)
848852
{
849853
const auto memBytes = DataFormat::getMemsize(reinterpret_cast<const char*>(pageAddress));
854+
855+
// It is useful to also report the orbit and the bunch crossing on error
856+
const auto orbit = DataFormat::getOrbit(reinterpret_cast<const char*>(pageAddress));
857+
const auto bunchCrossing = DataFormat::getBunchCrossing(reinterpret_cast<const char*>(pageAddress));
858+
850859
if (memBytes > pageSize) {
851860
mErrorCount++;
852861
if (mErrorCount < MAX_RECORDED_ERRORS) {
853-
mErrorStream << b::format("[RDHERR]\tevent:%1% l:%2% payloadBytes:%3% size:%4% words out of ranger\n") % eventNumber % linkId % memBytes % pageSize;
862+
mErrorStream << b::format("[RDHERR]\tevent:%d l:%d o:0x%x bc:0x%x payloadBytes:%d size:%d words out of ranger\n") % eventNumber % linkId % orbit % bunchCrossing % memBytes % pageSize;
854863
}
855864
return true;
856865
}
@@ -859,14 +868,14 @@ class ProgramDmaBench : public Program
859868

860869
if (mPacketCounters[linkId] == PACKET_COUNTER_INITIAL_VALUE) {
861870
if (mErrorCount < MAX_RECORDED_ERRORS) {
862-
mErrorStream << b::format("resync packet counter for e%d l:%d packet_cnt:%x mpacket_cnt:%x, le:%d \n") % eventNumber % linkId % packetCounter %
871+
mErrorStream << b::format("resync packet counter for e%d l:%d o:0x%x bc:0x%x packet_cnt:0x%x mpacket_cnt:0x%x, le:%d \n") % eventNumber % linkId % orbit % bunchCrossing % packetCounter %
863872
mPacketCounters[linkId] % mEventCounters[linkId];
864873
}
865874
mPacketCounters[linkId] = packetCounter;
866875
} else if (((mPacketCounters[linkId] + mErrorCheckFrequency) % (mMaxRdhPacketCounter + 1)) != packetCounter) {
867876
mErrorCount++;
868877
if (mErrorCount < MAX_RECORDED_ERRORS) {
869-
mErrorStream << b::format("[RDHERR]\tevent:%1% l:%2% packet_cnt:%3% mpacket_cnt:%4% unexpected packet counter\n") % eventNumber % linkId % packetCounter % mPacketCounters[linkId];
878+
mErrorStream << b::format("[RDHERR]\tevent:%d l:%d o:0x%x bc:0x%x packet_cnt:0x%x mpacket_cnt:0x%x unexpected packet counter\n") % eventNumber % linkId % orbit % bunchCrossing % packetCounter % mPacketCounters[linkId];
870879
}
871880
return true;
872881
} else {
@@ -877,7 +886,7 @@ class ProgramDmaBench : public Program
877886
// log TF not at the beginning of the superpage error
878887
mErrorCount++;
879888
if (mErrorCount < MAX_RECORDED_ERRORS) {
880-
mErrorStream << b::format("[RDHERR]\tevent:%1% l:%2% payloadBytes:%3% size:%4% packet_cnt:%5% orbit:%6$#x nextTForbit:%7$#x atSPStart:%8% TF unaligned w/ start of superpage\n") % eventNumber % linkId % memBytes % pageSize % packetCounter % mOrbit % mNextTFOrbit % atStartOfSuperpage;
889+
mErrorStream << b::format("[RDHERR]\tevent:%d l:%d o:0x%x bc:0x%x payloadBytes:%d size:%d packet_cnt:0x%x nextTForbit:0x%x atSPStart:%b TF unaligned w/ start of superpage\n") % eventNumber % linkId % orbit % bunchCrossing % memBytes % pageSize % packetCounter % mNextTFOrbit % atStartOfSuperpage;
881890
}
882891
}
883892

0 commit comments

Comments
 (0)