Skip to content

Commit bdbe326

Browse files
Add options for pause time for push/read thread
1 parent 0f59595 commit bdbe326

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/CommandLineUtilities/ProgramDmaBench.cxx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ constexpr auto LINK_COUNTER_INITIAL_VALUE = std::numeric_limits<uint64_t>::max()
5656
constexpr auto MAX_LINKS = 32;
5757
/// Interval for low priority thread (display updates, etc)
5858
constexpr auto LOW_PRIORITY_INTERVAL = 10ms;
59-
/// Resting time if push thread has nothing to do
60-
constexpr auto RESTING_TIME_PUSH_THREAD = 1us;
61-
/// Resting time if readout thread has nothing to do
62-
constexpr auto RESTING_TIME_READOUT_THREAD = 10us;
6359
/// Buffer value to reset to
6460
constexpr uint32_t BUFFER_DEFAULT_VALUE = 0xCcccCccc;
6561
/// Fields: Time(hour:minute:second), Pages pushed, Pages read, Errors, °C
@@ -160,6 +156,12 @@ class ProgramDmaBench: public Program
160156
("pattern",
161157
po::value<std::string>(&mOptions.generatorPatternString)->default_value("INCREMENTAL"),
162158
"Error check with given pattern [INCREMENTAL, ALTERNATING, CONSTANT, RANDOM]")
159+
("pause-push",
160+
po::value<uint64_t>(&mOptions.pausePush)->default_value(1),
161+
"Push thread pause time in microseconds if no work can be done")
162+
("pause-read",
163+
po::value<uint64_t>(&mOptions.pauseRead)->default_value(10),
164+
"Readout thread pause time in microseconds if no work can be done")
163165
("random-pause",
164166
po::bool_switch(&mOptions.randomPause),
165167
"Randomly pause readout")
@@ -458,7 +460,7 @@ class ProgramDmaBench: public Program
458460
}
459461

460462
if (shouldRest) {
461-
std::this_thread::sleep_for(RESTING_TIME_PUSH_THREAD);
463+
std::this_thread::sleep_for(std::chrono::microseconds(mOptions.pausePush));
462464
}
463465
}
464466
}
@@ -497,7 +499,7 @@ class ProgramDmaBench: public Program
497499
}
498500
} else {
499501
// No superpages available to read out, so have a nap
500-
std::this_thread::sleep_for(RESTING_TIME_READOUT_THREAD);
502+
std::this_thread::sleep_for(std::chrono::microseconds(mOptions.pauseRead));
501503
}
502504
}
503505
}
@@ -931,6 +933,8 @@ class ProgramDmaBench: public Program
931933
size_t dmaPageSize;
932934
std::string loopbackModeString;
933935
std::string timeLimitString;
936+
uint64_t pausePush;
937+
uint64_t pauseRead;
934938
} mOptions;
935939

936940
/// The DMA channel

0 commit comments

Comments
 (0)