Skip to content

Commit 2fb7ccc

Browse files
committed
Fix dma bench throughput calculation
1 parent dd7b215 commit 2fb7ccc

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,6 @@ class ProgramDmaBench: public Program
347347
<< endm;
348348
}
349349

350-
mRunTime.start = std::chrono::steady_clock::now();
351350
dmaLoop();
352351
mRunTime.end = std::chrono::steady_clock::now();
353352

@@ -414,6 +413,10 @@ class ProgramDmaBench: public Program
414413
// Status display updates
415414
// Wait until the DMA has really started before printing our table to avoid messy output
416415
if (!mOptions.noDisplay && mPushCount.load(std::memory_order_relaxed) != 0) {
416+
if (!mRunTimeStarted) { // Start counting time when the first page arrives
417+
mRunTime.start = std::chrono::steady_clock::now();
418+
mRunTimeStarted = true;
419+
}
417420
updateStatusDisplay();
418421
}
419422
next += LOW_PRIORITY_INTERVAL;
@@ -862,7 +865,7 @@ class ProgramDmaBench: public Program
862865
format % (mReadoutCount.load(std::memory_order_relaxed) / mPagesPerSuperpage);
863866

864867
double runTime = std::chrono::duration<double>(steady_clock::now() - mRunTime.start).count();
865-
double bytes = double(mReadoutCount.load()) * mPageSize;
868+
double bytes = double(mReadoutCount.load(std::memory_order_relaxed)) * mPageSize;
866869
double Gb = bytes * 8 / (1000 * 1000 * 1000);
867870
double Gbps = Gb / runTime;
868871
format % Gbps;
@@ -1152,6 +1155,9 @@ class ProgramDmaBench: public Program
11521155
TimePoint start; ///< Start of run time
11531156
TimePoint end; ///< End of run time
11541157
} mRunTime;
1158+
1159+
/// Flag that marks that runtime has started
1160+
bool mRunTimeStarted = false;
11551161
};
11561162

11571163
int main(int argc, char** argv)

0 commit comments

Comments
 (0)