Skip to content

Commit 1069e68

Browse files
committed
[readoutcard] Assign InfoLogger error codes
1 parent dee8775 commit 1069e68

File tree

13 files changed

+140
-95
lines changed

13 files changed

+140
-95
lines changed

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Table of Contents
1414
* [BAR interface](#bar-interface)
1515
* [Parameters](#parameters-1)
1616
* [Utility programs](#utility-programs)
17+
* [Logging](#logging)
1718
* [Exceptions](#exceptions)
1819
* [Python interface](#python-interface)
1920
3. [Installation](#installation)
@@ -657,6 +658,50 @@ metric format for the CRORC and the CRU is different, as different parameters ar
657658
| `tags::Key::ID` | ID of the link |
658659
| `tags::Key::Type` | `tags::Value::CRU` |
659660
661+
Logging
662+
-------------------
663+
Logging is achieved through the use of the [InfoLogger](https://github.com/AliceO2Group/InfoLogger) library.
664+
665+
Error codes in the range 4000-4999 are assigned to ReadoutCard. These are further partitioned according to components:
666+
667+
### General
668+
| 4000 - 4099 | Full Range |
669+
| ----------- | ---------- |
670+
| 4000 - 4010 | Internal logger |
671+
672+
### PDA
673+
| 4100 - 4199 | Full Range |
674+
| ----------- | ---------- |
675+
676+
### DMA
677+
| 4200 - 4399 | Full Range |
678+
| ----------- | ---------- |
679+
| 4200 - 4239 | General DMA |
680+
| 4250 - 4299 | CRU DMA |
681+
| 4300 - 4349 | CRORC DMA |
682+
683+
### Card Configuration
684+
| 4600 - 4699 | Full Range |
685+
| ----------- | ---------- |
686+
| 4600 - 4649 | CRU |
687+
| 4650 - 4699 | CRORC |
688+
689+
### Cleanup
690+
| 4700 - 4799 | Full Range |
691+
| ----------- | ---------- |
692+
693+
### Reports
694+
| 4800 - 4899 | Full Range |
695+
| ----------- | ------------ |
696+
| 4800 - 4804 | CTP emulator |
697+
698+
### Unassigned
699+
| Range |
700+
| ----- |
701+
| 4350 - 4599 |
702+
| 4900 - 4999 |
703+
704+
660705
Exceptions
661706
-------------------
662707
The module makes use of exceptions. Nearly all of these are derived from `boost::exception`.

src/CommandLineUtilities/ProgramCleanup.cxx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ class ProgramCleanup : public Program
8282
return {};
8383
};
8484

85-
Logger::get() << "`roc-cleanup` execution initiated by " << getUsername() << LogDebugOps << endm;
85+
Logger::get() << "`roc-cleanup` execution initiated by " << getUsername() << LogDebugOps_(4700) << endm;
8686

8787
// Take and hold DMA locks during cleanup
8888
std::vector<std::unique_ptr<Interprocess::Lock>> dmaLocks;
8989

90-
Logger::get() << "Grabbing PDA & DMA locks" << LogDebugDevel << endm;
90+
Logger::get() << "Grabbing PDA & DMA locks" << LogDebugDevel_(4701) << endm;
9191
try {
9292
auto cards = findCards();
9393

@@ -103,31 +103,31 @@ class ProgramCleanup : public Program
103103
} // ignore an invalid card type
104104
}
105105
} catch (std::runtime_error& e) {
106-
Logger::get() << e.what() << LogErrorDevel << endm;
106+
Logger::get() << e.what() << LogErrorDevel_(4702) << endm;
107107
return;
108108
}
109109

110110
Pda::freePdaDmaBuffers();
111111

112-
Logger::get() << "Removing CRORC FIFO shared memory files" << LogDebugDevel << endm;
112+
Logger::get() << "Removing CRORC FIFO shared memory files" << LogDebugDevel_(4703) << endm;
113113
sysCheckRet("rm /dev/shm/*_sp_info");
114-
Logger::get() << "Removing readout 2MB hugepage mappings" << LogDebugDevel << endm;
114+
Logger::get() << "Removing readout 2MB hugepage mappings" << LogDebugDevel_(4704) << endm;
115115
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-2MB/readout*");
116-
Logger::get() << "Removing readout 1GB hugepage mappings" << LogDebugDevel << endm;
116+
Logger::get() << "Removing readout 1GB hugepage mappings" << LogDebugDevel_(4705) << endm;
117117
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-1GB/readout*");
118-
Logger::get() << "Removing o2-roc-bench-dma 2MB hugepage mappings" << LogDebugDevel << endm;
118+
Logger::get() << "Removing o2-roc-bench-dma 2MB hugepage mappings" << LogDebugDevel_(4706) << endm;
119119
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-2MB/roc-bench-dma*");
120-
Logger::get() << "Removing o2-roc-bench-dma 1GB hugepage mappings" << LogDebugDevel << endm;
120+
Logger::get() << "Removing o2-roc-bench-dma 1GB hugepage mappings" << LogDebugDevel_(4707) << endm;
121121
sysCheckRet("rm /var/lib/hugetlbfs/global/pagesize-1GB/roc-bench-dma*");
122122

123123
if (!mOptions.light) {
124-
Logger::get() << "Removing uio_pci_dma" << LogDebugDevel << endm;
124+
Logger::get() << "Removing uio_pci_dma" << LogDebugDevel_(4708) << endm;
125125
sysCheckRet("modprobe -r uio_pci_dma");
126-
Logger::get() << "Reinserting uio_pci_dma" << LogDebugDevel << endm;
126+
Logger::get() << "Reinserting uio_pci_dma" << LogDebugDevel_(4709) << endm;
127127
sysCheckRet("modprobe uio_pci_dma");
128128
}
129129

130-
Logger::get() << "`roc-cleanup` execution finished" << LogDebugOps << endm;
130+
Logger::get() << "`roc-cleanup` execution finished" << LogDebugOps_(4710) << endm;
131131
return;
132132
}
133133

src/CommandLineUtilities/ProgramConfig.cxx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -138,25 +138,25 @@ class ProgramConfig : public Program
138138

139139
// Configure all cards found - Normally used during boot
140140
if (mOptions.configAll) {
141-
Logger::get() << "Running RoC Configuration for all cards" << LogInfoOps << endm;
141+
Logger::get() << "Running RoC Configuration for all cards" << LogInfoOps_(4600) << endm;
142142
std::vector<CardDescriptor> cardsFound;
143143
if (mOptions.configUri == "") {
144-
Logger::get() << "A configuration URI is necessary with the startup-config flag set" << LogErrorOps << endm;
144+
Logger::get() << "A configuration URI is necessary with the startup-config flag set" << LogErrorOps_(4600) << endm;
145145
return;
146146
}
147147

148148
cardsFound = RocPciDevice::findSystemDevices();
149149
for (auto const& card : cardsFound) {
150-
Logger::get() << " __== " << card.pciAddress.toString() << " ==__ " << LogDebugTrace << endm;
150+
Logger::get() << " __== " << card.pciAddress.toString() << " ==__ " << LogDebugTrace_(4600) << endm;
151151
auto params = Parameters::makeParameters(card.pciAddress, 2);
152152
if (!mOptions.bypassFirmwareCheck) {
153153
try {
154154
FirmwareChecker().checkFirmwareCompatibility(params);
155155
CardConfigurator(card.pciAddress, mOptions.configUri, mOptions.forceConfig);
156156
} catch (const std::runtime_error& e) {
157-
Logger::get() << e.what() << LogErrorOps << endm;
157+
Logger::get() << e.what() << LogErrorOps_(4600) << endm;
158158
} catch (const Exception& e) {
159-
Logger::get() << boost::diagnostic_information(e) << LogErrorOps << endm;
159+
Logger::get() << boost::diagnostic_information(e) << LogErrorOps_(4600) << endm;
160160
}
161161
}
162162
}
@@ -169,7 +169,7 @@ class ProgramConfig : public Program
169169
try {
170170
FirmwareChecker().checkFirmwareCompatibility(cardId);
171171
} catch (const Exception& e) {
172-
Logger::get() << boost::diagnostic_information(e) << LogErrorOps << endm;
172+
Logger::get() << boost::diagnostic_information(e) << LogErrorOps_(4600) << endm;
173173
throw;
174174
}
175175
}
@@ -241,25 +241,25 @@ class ProgramConfig : public Program
241241
return;
242242
}
243243

244-
Logger::get() << "Configuring card " << cardId << " with command line arguments" << LogDebugOps << endm;
244+
Logger::get() << "Configuring card " << cardId << " with command line arguments" << LogDebugOps_(4600) << endm;
245245
try {
246246
CardConfigurator(params, mOptions.forceConfig);
247247
} catch (const std::runtime_error& e) {
248-
Logger::get() << e.what() << LogErrorOps << endm;
248+
Logger::get() << e.what() << LogErrorOps_(4600) << endm;
249249
throw;
250250
} catch (const Exception& e) {
251-
Logger::get() << e.what() << LogErrorOps << endm;
251+
Logger::get() << e.what() << LogErrorOps_(4600) << endm;
252252
throw;
253253
}
254254
} else {
255-
Logger::get() << "Configuring card " << cardId << " with config uri: " << mOptions.configUri << LogDebugOps << endm;
255+
Logger::get() << "Configuring card " << cardId << " with config uri: " << mOptions.configUri << LogDebugOps_(4600) << endm;
256256
try {
257257
CardConfigurator(cardId, mOptions.configUri, mOptions.forceConfig);
258258
} catch (const std::runtime_error& e) {
259-
Logger::get() << e.what() << LogErrorOps << endm;
259+
Logger::get() << e.what() << LogErrorOps_(4600) << endm;
260260
throw;
261261
} catch (const Exception& e) {
262-
Logger::get() << e.what() << LogErrorOps << endm;
262+
Logger::get() << e.what() << LogErrorOps_(4600) << endm;
263263
throw;
264264
}
265265
}

src/CommandLineUtilities/ProgramCtpEmulator.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ class ProgramCtpEmulator : public Program
8484

8585
CardType::type cardType = bar2->getCardType();
8686
if (cardType == CardType::type::Crorc) {
87-
Logger::get() << "CRORC not supported" << LogErrorOps << endm;
87+
Logger::get() << "CRORC not supported" << LogErrorOps_(4803) << endm;
8888
return;
8989
} else if (cardType != CardType::type::Cru) {
90-
Logger::get() << "Invalid card type" << LogErrorOps << endm;
90+
Logger::get() << "Invalid card type" << LogErrorOps_(4804) << endm;
9191
return;
9292
}
9393

src/Crorc/CrorcBar.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,28 +106,28 @@ int CrorcBar::getEndpointNumber()
106106

107107
void CrorcBar::configure(bool /*force*/)
108108
{
109-
log("Configuring...", LogInfoOps);
109+
log("Configuring...", LogInfoOps_(4650));
110110

111111
// enable laser
112-
log("Enabling the laser", LogInfoDevel);
112+
log("Enabling the laser", LogInfoDevel_(4651));
113113
setQsfpEnabled();
114114

115-
log("Configuring fixed/dynamic offset", LogInfoDevel);
115+
log("Configuring fixed/dynamic offset", LogInfoDevel_(4652));
116116
// choose between fixed and dynamic offset
117117
setDynamicOffsetEnabled(mDynamicOffset);
118118

119119
// set crorc id
120-
log("Setting the CRORC ID", LogInfoDevel);
120+
log("Setting the CRORC ID", LogInfoDevel_(4653));
121121
setCrorcId(mCrorcId);
122122

123123
// set timeframe length
124-
log("Setting the Time Frame length", LogInfoDevel);
124+
log("Setting the Time Frame length", LogInfoDevel_(4654));
125125
setTimeFrameLength(mTimeFrameLength);
126126

127-
log("Configuring Time Frame detection", LogInfoDevel);
127+
log("Configuring Time Frame detection", LogInfoDevel_(4655));
128128
setTimeFrameDetectionEnabled(mTimeFrameDetectionEnabled);
129129

130-
log("CRORC configuration done", LogInfoOps);
130+
log("CRORC configuration done", LogInfoOps_(4656));
131131
}
132132

133133
Crorc::ReportInfo CrorcBar::report(bool forConfig)
@@ -314,7 +314,7 @@ void CrorcBar::stopTrigger()
314314
try {
315315
sendDdlCommand(Crorc::Registers::DDL_COMMAND.address, Crorc::Registers::EOBTR);
316316
} catch (const Exception& e) {
317-
log("Stopping DDL trigger timed out");
317+
log("Stopping DDL trigger timed out", LogInfoDevel_(4656));
318318
}
319319
}
320320

src/Crorc/CrorcDmaChannel.cxx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ CrorcDmaChannel::CrorcDmaChannel(const Parameters& parameters)
6363
crorcBar = std::move(std::dynamic_pointer_cast<CrorcBar>(bar)); // Initialize bar
6464

6565
// Create and register our Superpage info (size + count) buffer
66-
log("Initializing Superpage info buffer", LogDebugDevel);
66+
log("Initializing Superpage info buffer", LogDebugDevel_(4300));
6767
{
6868
// Create and register the buffer
6969
// Note: if resizing the file fails, we might've accidentally put the file in a hugetlbfs mount with 1 GB page size
@@ -117,11 +117,11 @@ void CrorcDmaChannel::deviceStartDma()
117117
}
118118

119119
if (mGeneratorEnabled) {
120-
log("Starting data generator", LogInfoDevel);
120+
log("Starting data generator", LogInfoDevel_(4301));
121121
startDataGenerator();
122122
} else {
123123
if (mRDYRX || mSTBRD) {
124-
log("Starting trigger", LogInfoDevel);
124+
log("Starting trigger", LogInfoDevel_(4302));
125125

126126
// Clearing SIU/DIU status.
127127
getBar()->assertLinkUp();
@@ -134,7 +134,7 @@ void CrorcDmaChannel::deviceStartDma()
134134

135135
std::this_thread::sleep_for(100ms);
136136

137-
log("DMA started", LogInfoOps);
137+
log("DMA started", LogInfoOps_(4303));
138138
}
139139

140140
void CrorcDmaChannel::deviceStopDma()

0 commit comments

Comments
 (0)