Skip to content

Commit 175dc5d

Browse files
committed
To the provdb benchmark, added a cmdline option to make the benchmark sleep when the number of outstanding async sends reaches a threshold until 0
1 parent 3457535 commit 175dc5d

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

benchmark_suite/benchmark_provdb/benchmark_client.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ struct Args{
3131
int perf_write_freq;
3232
std::string perf_dir;
3333
bool do_state_dump; //have the provdb record its state every time the perf stats are written (by rank 0)
34+
int max_outstanding_sends; //if set >0 the benchmark will pause when the number of outstanding asynchronous sends reaches this number until it reaches 0 again
3435

3536
Args(){
3637
cycles = 10;
@@ -45,6 +46,7 @@ struct Args{
4546
perf_write_freq = 10;
4647
perf_dir=".";
4748
do_state_dump = false;
49+
max_outstanding_sends = 0;
4850
}
4951
};
5052

@@ -73,6 +75,8 @@ int main(int argc, char **argv){
7375
addOptionalCommandLineArgDefaultHelpString(cmdline, perf_write_freq);
7476
addOptionalCommandLineArgDefaultHelpString(cmdline, perf_dir);
7577
addOptionalCommandLineArgDefaultHelpString(cmdline, do_state_dump);
78+
addOptionalCommandLineArgDefaultHelpString(cmdline, max_outstanding_sends);
79+
7680

7781
if(argc == 1 || (argc == 2 && std::string(argv[1]) == "-help")){
7882
cmdline.help();
@@ -182,7 +186,8 @@ int main(int argc, char **argv){
182186
async_send_calls+=2;
183187

184188
if(c>0 && c % args.perf_write_freq == 0){
185-
stats_prd.add("provdb_incomplete_async_sends", provdb_client.getNoutstandingAsyncReqs());
189+
int noutstanding = provdb_client.getNoutstandingAsyncReqs();
190+
stats_prd.add("provdb_incomplete_async_sends", noutstanding);
186191
stats_prd.add("io_steps", n_steps_accum_prd);
187192
stats_prd.add("provdb_total_async_send_calls", async_send_calls);
188193

@@ -193,6 +198,15 @@ int main(int argc, char **argv){
193198
provdb_client.serverDumpState();
194199

195200
n_steps_accum_prd = 0;
201+
202+
if(args.max_outstanding_sends > 0 && noutstanding >= args.max_outstanding_sends){
203+
std::cout << "Number of outstanding sends, " << noutstanding << " exceeds threshold " << args.max_outstanding_sends << ", sleeping until the queue is flushed" << std::endl;
204+
timer.start();
205+
while(provdb_client.getNoutstandingAsyncReqs()>0){
206+
std::this_thread::sleep_for(std::chrono::milliseconds(500));
207+
}
208+
std::cout << "Woke up after " << timer.elapsed_ms() << "ms waiting for async send queue to drain" << std::endl;
209+
}
196210
}
197211
}//cycle loop
198212

0 commit comments

Comments
 (0)