Skip to content

Commit 87d187e

Browse files
Stop DMA before popping excess superpages
1 parent 6e795e6 commit 87d187e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -326,12 +326,14 @@ class ProgramDmaBench: public Program
326326
mBarHammer->join();
327327
}
328328

329-
freeExcessPages(10ms);
329+
std::cout << "\n";
330330
mChannel->stopDma();
331+
int popped = freeExcessPages(10ms);
332+
std::cout << "\n";
333+
getLogger() << "Popped " << popped << " remaining superpages" << endm;
331334

332335
outputErrors();
333336
outputStats();
334-
335337
getLogger() << "Benchmark complete" << endm;
336338
}
337339

@@ -513,7 +515,7 @@ class ProgramDmaBench: public Program
513515
}
514516

515517
/// Free the pages that were pushed in excess
516-
void freeExcessPages(std::chrono::milliseconds timeout)
518+
int freeExcessPages(std::chrono::milliseconds timeout)
517519
{
518520
// First deal with the remaining filled superpages
519521
auto start = std::chrono::steady_clock::now();
@@ -524,13 +526,11 @@ class ProgramDmaBench: public Program
524526
if (superpage.isFilled()) {
525527
readoutPage(mBufferBaseAddress + superpage.getOffset(), superpage.getSize(), fetchAddReadoutCount());
526528
mChannel->popSuperpage();
527-
popped += superpage.getReceived() / mPageSize;
529+
popped++;
528530
}
529531
}
530532
}
531-
532-
std::cout << "\n\n";
533-
getLogger() << "Popped " << popped << " excess filled pages" << endm;
533+
return popped;
534534
}
535535

536536
uint32_t get32bitFromPage(uintptr_t pageAddress, size_t index)

0 commit comments

Comments
 (0)