File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -514,21 +514,19 @@ class ProgramDmaBench: public Program
514514 return mReadoutCount .fetch_add (1 , std::memory_order_relaxed);
515515 }
516516
517- // / Free the pages that were pushed in excess
517+ // / Free the pages that remain after stopping DMA (these may not be filled)
518518 int freeExcessPages (std::chrono::milliseconds timeout)
519519 {
520- // First deal with the remaining filled superpages
521520 auto start = std::chrono::steady_clock::now ();
522521 int popped = 0 ;
523522 while ((std::chrono::steady_clock::now () - start) < timeout) {
524- if (mChannel ->getReadyQueueSize () > 0 ) {
523+ auto size = mChannel ->getReadyQueueSize ();
524+ for (int i = 0 ; i < size; ++i) {
525525 auto superpage = mChannel ->getSuperpage ();
526- if (superpage.isFilled ()) {
527- readoutPage (mBufferBaseAddress + superpage.getOffset (), superpage.getSize (), fetchAddReadoutCount ());
528- mChannel ->popSuperpage ();
529- popped++;
530- }
526+ readoutPage (mBufferBaseAddress + superpage.getOffset (), superpage.getSize (), fetchAddReadoutCount ());
527+ mChannel ->popSuperpage ();
531528 }
529+ popped += size;
532530 }
533531 return popped;
534532 }
You can’t perform that action at this time.
0 commit comments