summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2003-09-29 06:04:23 +0000
committerAndrew Tridgell <tridge@samba.org>2003-09-29 06:04:23 +0000
commitbd1ca8773318c931bad0a039a39f925ab087a410 (patch)
tree8b85b6b0158e15964d526f6ba11379403d7d6142
parent8205817eeca2259262d44461917ab0cc4c99e9e6 (diff)
downloadsamba-bd1ca8773318c931bad0a039a39f925ab087a410.tar.gz
samba-bd1ca8773318c931bad0a039a39f925ab087a410.tar.bz2
samba-bd1ca8773318c931bad0a039a39f925ab087a410.zip
better child synchronisation at startup in NBENCH
(This used to be commit 4559208c80e0368ff677bfe0e6cde0abb8b9b2c0)
-rw-r--r--source4/torture/torture.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/source4/torture/torture.c b/source4/torture/torture.c
index c928846f1f..f54483ae45 100644
--- a/source4/torture/torture.c
+++ b/source4/torture/torture.c
@@ -3607,9 +3607,6 @@ BOOL torture_chkpath_test(int dummy)
return ret;
}
-
-
-
static BOOL run_dirtest1(int dummy)
{
int i;
@@ -3766,6 +3763,7 @@ static double create_procs(BOOL (*fn)(int), BOOL *result)
volatile BOOL *child_status_out;
int synccount;
int tries = 8;
+ double start_time_limit = 10 + (nprocs * 0.5);
synccount = 0;
@@ -3805,12 +3803,18 @@ static double create_procs(BOOL (*fn)(int), BOOL *result)
printf("pid %d failed to start\n", (int)getpid());
_exit(1);
}
- msleep(10);
+ msleep(100);
}
child_status[i] = getpid();
- while (child_status[i] && end_timer() < 5) msleep(2);
+ while (child_status[i] && end_timer() < start_time_limit) msleep(2);
+
+ if (child_status[i]) {
+ printf("Child %d failed to start!\n", i);
+ child_status_out[i] = 1;
+ _exit(1);
+ }
child_status_out[i] = fn(i);
_exit(0);
@@ -3823,8 +3827,8 @@ static double create_procs(BOOL (*fn)(int), BOOL *result)
if (child_status[i]) synccount++;
}
if (synccount == nprocs) break;
- msleep(10);
- } while (end_timer() < 30);
+ msleep(100);
+ } while (end_timer() < start_time_limit);
if (synccount != nprocs) {
printf("FAILED TO START %d CLIENTS (started %d)\n", nprocs, synccount);
@@ -3832,6 +3836,8 @@ static double create_procs(BOOL (*fn)(int), BOOL *result)
return end_timer();
}
+ printf("Starting %d clients\n", nprocs);
+
/* start the client load */
start_timer();
@@ -3842,7 +3848,11 @@ static double create_procs(BOOL (*fn)(int), BOOL *result)
printf("%d clients started\n", nprocs);
for (i=0;i<nprocs;i++) {
- while (waitpid(0, &status, 0) == -1 && errno == EINTR) /* noop */ ;
+ int ret;
+ while ((ret=waitpid(0, &status, 0)) == -1 && errno == EINTR) /* noop */ ;
+ if (ret == -1 || WEXITSTATUS(status) != 0) {
+ *result = False;
+ }
}
printf("\n");