Skip to content

Commit 5b7c2d4

Browse files
authored
Splitting IO and wait time in metrics (#5368)
1 parent beaee0e commit 5b7c2d4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

Framework/AnalysisSupport/src/AODJAlienReaderHelpers.cxx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,14 @@ static inline auto extractOriginalsTuple(framework::pack<Os...>, ProcessingConte
144144
return std::make_tuple(extractTypedOriginal<Os>(pc)...);
145145
}
146146

147-
void AODJAlienReaderHelpers::dumpFileMetrics(Monitoring& monitoring, TFile* currentFile, uint64_t startedAt, int tfPerFile, int tfRead)
147+
void AODJAlienReaderHelpers::dumpFileMetrics(Monitoring& monitoring, TFile* currentFile, uint64_t startedAt, uint64_t ioTime, int tfPerFile, int tfRead)
148148
{
149149
if (currentFile == nullptr) {
150150
return;
151151
}
152-
std::string monitoringInfo(fmt::format("lfn={},size={},total_tf={},read_tf={},read_bytes={},read_calls={},run_time={:.1f}", currentFile->GetName(),
153-
currentFile->GetSize(), tfPerFile, tfRead, currentFile->GetBytesRead(), currentFile->GetReadCalls(), ((float)(uv_hrtime() - startedAt) / 1e9)));
152+
std::string monitoringInfo(fmt::format("lfn={},size={},total_tf={},read_tf={},read_bytes={},read_calls={},io_time={:.1f},wait_time={:.1f}", currentFile->GetName(),
153+
currentFile->GetSize(), tfPerFile, tfRead, currentFile->GetBytesRead(), currentFile->GetReadCalls(),
154+
((float)ioTime / 1e9), ((float)(uv_hrtime() - startedAt - ioTime) / 1e9)));
154155
#if __has_include(<TJAlienFile.h>)
155156
auto alienFile = dynamic_cast<TJAlienFile*>(currentFile);
156157
if (alienFile) {
@@ -233,19 +234,22 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback()
233234
static TFile* currentFile = nullptr;
234235
static int tfCurrentFile = -1;
235236
static auto currentFileStartedAt = uv_hrtime();
237+
static uint64_t currentFileIOTime = 0;
236238

237239
// check if RuntimeLimit is reached
238240
if (!watchdog->update()) {
239241
LOGP(INFO, "Run time exceeds run time limit of {} seconds!", watchdog->runTimeLimit);
240242
LOGP(INFO, "Stopping reader {} after time frame {}.", device.inputTimesliceId, watchdog->numberTimeFrames - 1);
241-
dumpFileMetrics(monitoring, currentFile, currentFileStartedAt, tfCurrentFile, ntf);
243+
dumpFileMetrics(monitoring, currentFile, currentFileStartedAt, currentFileIOTime, tfCurrentFile, ntf);
242244
monitoring.flushBuffer();
243245
didir->closeInputFiles();
244246
control.endOfStream();
245247
control.readyToQuit(QuitRequest::Me);
246248
return;
247249
}
248250

251+
auto ioStart = uv_hrtime();
252+
249253
for (auto route : requestedTables) {
250254

251255
// create header
@@ -257,9 +261,10 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback()
257261
if (!tr) {
258262
if (first) {
259263
// dump metrics of file which is done for reading
260-
dumpFileMetrics(monitoring, currentFile, currentFileStartedAt, tfCurrentFile, ntf);
264+
dumpFileMetrics(monitoring, currentFile, currentFileStartedAt, currentFileIOTime, tfCurrentFile, ntf);
261265
currentFile = nullptr;
262266
currentFileStartedAt = uv_hrtime();
267+
currentFileIOTime = 0;
263268

264269
// check if there is a next file to read
265270
fcnt += device.maxInputTimeslices;
@@ -326,6 +331,7 @@ AlgorithmSpec AODJAlienReaderHelpers::rootFileReaderCallback()
326331
// save file number and time frame
327332
*fileCounter = (fcnt - device.inputTimesliceId) / device.maxInputTimeslices;
328333
*numTF = ntf;
334+
currentFileIOTime += (uv_hrtime() - ioStart);
329335
});
330336
})};
331337

Framework/AnalysisSupport/src/AODJAlienReaderHelpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace o2::framework::readers
2222

2323
struct AODJAlienReaderHelpers {
2424
static AlgorithmSpec rootFileReaderCallback();
25-
static void dumpFileMetrics(o2::monitoring::Monitoring& monitoring, TFile* currentFile, uint64_t startedAt, int tfPerFile, int tfRead);
25+
static void dumpFileMetrics(o2::monitoring::Monitoring& monitoring, TFile* currentFile, uint64_t startedAt, uint64_t ioTime, int tfPerFile, int tfRead);
2626
};
2727

2828
} // namespace o2::framework::readers

0 commit comments

Comments
 (0)