From bd1ca8773318c931bad0a039a39f925ab087a410 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 29 Sep 2003 06:04:23 +0000 Subject: better child synchronisation at startup in NBENCH (This used to be commit 4559208c80e0368ff677bfe0e6cde0abb8b9b2c0) --- source4/torture/torture.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source4') 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