From a4d04e7c217cb6c62083bd41387e2e3b4fb12f1e Mon Sep 17 00:00:00 2001 From: Waqar Ahmed Khan Date: Mon, 15 Jul 2024 18:22:46 +0000 Subject: [PATCH] Revert "recreate s3 client and sleep" This reverts commit 2c1a20ba69c92e2cfa178dfd7a609b01d9619dc4. --- runners/s3-benchrunner-c/benchrunner.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/runners/s3-benchrunner-c/benchrunner.cpp b/runners/s3-benchrunner-c/benchrunner.cpp index 3541d28d..0a4063a6 100644 --- a/runners/s3-benchrunner-c/benchrunner.cpp +++ b/runners/s3-benchrunner-c/benchrunner.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include #include @@ -637,13 +636,14 @@ int main(int argc, char *argv[]) string region = argv[4]; double targetThroughputGbps = stod(argv[5]); + auto benchmark = Benchmark(config, bucket, region, targetThroughputGbps); + uint64_t bytesPerRun = config.bytesPerRun(); + // Repeat benchmark until we exceed maxRepeatCount or maxRepeatSecs std::vector durations; auto appStart = high_resolution_clock::now(); - uint64_t bytesPerRun = config.bytesPerRun(); for (int runI = 0; runI < config.maxRepeatCount; ++runI) { - auto benchmark = Benchmark(config, bucket, region, targetThroughputGbps); auto runStart = high_resolution_clock::now(); benchmark.run(); @@ -655,9 +655,13 @@ int main(int argc, char *argv[]) printf("Run:%d Secs:%f Gb/s:%f\n", runI + 1, runSecs, bytesToGigabit(bytesPerRun) / runSecs); fflush(stdout); - std::this_thread::sleep_for(std::chrono::seconds(30)); + // break out if we've exceeded maxRepeatSecs + duration appDurationSecs = high_resolution_clock::now() - appStart; + if (appDurationSecs >= 1s * config.maxRepeatSecs) + break; } printStats(bytesPerRun, durations); + return 0; }