From 48c17b4d8162336beec60995b1cfc15a943a3307 Mon Sep 17 00:00:00 2001 From: "Julian M. Kunkel" Date: Sat, 7 Jul 2018 22:26:57 +0100 Subject: [PATCH] Extracted (nearly identical) function DelaySeconds. --- src/ior.c | 12 ------------ src/mdtest.c | 23 ++--------------------- src/utilities.c | 11 +++++++++++ src/utilities.h | 1 + 4 files changed, 14 insertions(+), 33 deletions(-) diff --git a/src/ior.c b/src/ior.c index d7dd096..93bdc69 100755 --- a/src/ior.c +++ b/src/ior.c @@ -670,18 +670,6 @@ static void DestroyTests(IOR_test_t *tests_head) } } -/* - * Sleep for 'delay' seconds. - */ -static void DelaySecs(int delay) -{ - if (rank == 0 && delay > 0) { - if (verbose >= VERBOSE_1) - fprintf(out_logfile, "delaying %d seconds . . .\n", delay); - sleep(delay); - } -} - /* * Display freespace (df). */ diff --git a/src/mdtest.c b/src/mdtest.c index 81b1df3..1f55bf1 100644 --- a/src/mdtest.c +++ b/src/mdtest.c @@ -174,25 +174,6 @@ typedef struct{ enum {MK_UNI_DIR, STAT_SUB_DIR, READ_SUB_DIR, RM_SUB_DIR, RM_UNI_DIR}; - -void delay_secs(int delay) { - - - if (( rank == 0 ) && ( verbose >= 1 )) { - fprintf( out_logfile, "V-1: Entering delay_secs...\n" ); - fflush( out_logfile ); - } - - if (rank == 0 && delay > 0) { - if (verbose >= 1) { - fprintf(out_logfile, "delaying %d seconds . . .\n", delay); - fflush(out_logfile); - } - sleep(delay); - } - MPI_Barrier(testComm); -} - void offset_timers(double * t, int tcount) { double toffset; int i; @@ -1938,13 +1919,13 @@ static void mdtest_iteration(int i, int j, MPI_Group testgroup, mdtest_results_t if (dirs_only && !shared_file) { if (pre_delay) { - delay_secs(pre_delay); + DelaySecs(pre_delay); } directory_test(j, i, unique_mk_dir, progress); } if (files_only) { if (pre_delay) { - delay_secs(pre_delay); + DelaySecs(pre_delay); } file_test(j, i, unique_mk_dir, progress); } diff --git a/src/utilities.c b/src/utilities.c index 05d6f46..a9f4910 100755 --- a/src/utilities.c +++ b/src/utilities.c @@ -586,3 +586,14 @@ void StoreStoneWallingIterations(char * const filename, int64_t count){ fprintf(out, "%lld", (long long) count); fclose(out); } + +/* + * Sleep for 'delay' seconds. + */ +void DelaySecs(int delay){ + if (rank == 0 && delay > 0) { + if (verbose >= VERBOSE_1) + fprintf(out_logfile, "delaying %d seconds . . .\n", delay); + sleep(delay); + } +} diff --git a/src/utilities.h b/src/utilities.h index 9759752..e1163da 100755 --- a/src/utilities.h +++ b/src/utilities.h @@ -55,6 +55,7 @@ void SeedRandGen(MPI_Comm); void SetHints (MPI_Info *, char *); void ShowHints (MPI_Info *); int CountTasksPerNode(MPI_Comm comm); +void DelaySecs(int delay); /* Returns -1, if cannot be read */ int64_t ReadStoneWallingIterations(char * const filename);