From 2f72882a824b42682352b09a790877cdfed1cda7 Mon Sep 17 00:00:00 2001 From: drotos Date: Tue, 16 Jan 2007 12:51:55 +0000 Subject: [PATCH] stress test to my own test app git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@1003 a7169a2c-3604-0410-bc95-c702d8d87f7a --- dcapi/condor/tm.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/dcapi/condor/tm.c b/dcapi/condor/tm.c index 85c957c51b..5c401748b8 100644 --- a/dcapi/condor/tm.c +++ b/dcapi/condor/tm.c @@ -15,7 +15,9 @@ #include "tc.h" -DC_Workunit *wu[10]; +#define MAX_WU 100 + +DC_Workunit *wut[MAX_WU]; extern char *_DC_state_name(DC_WUState state); @@ -51,7 +53,7 @@ create_long(int how_long) NULL }; char l[100]; - + printf("Creating long...\n"); if (how_long > 0) { @@ -59,7 +61,7 @@ create_long(int how_long) argv[0]= l; } wu= DC_createWU("long", (const char **)argv, 0, NULL); - printf("Created short wu: %p\n", wu); + printf("Created long wu: %p\n", wu); if (!wu) fail("DC_createWU", 0); return(wu); @@ -273,6 +275,43 @@ t(int what) DC_destroyWU(wu); break; } + case 6: + { + int i, nr= 40; + int done= 0; + DC_setMasterCb(result_cb, subresult_cb, message_cb); + printf("Creating and submitting wus...\n"); + for (i= 0; i < nr; i++) + { + wut[i]= create_long(10); + DC_submitWU(wut[i]); + } + while (!done) + { + done= 1; + for (i= 0; i < nr; i++) + { + printf("waiting to finish %d...\n", i); + if (wut[i] && + DC_getWUState(wut[i]) != DC_WU_FINISHED && + DC_getWUState(wut[i]) != DC_WU_UNKNOWN) + { + done= 0; + process(wut[i], 1); + } + } + } + printf("All WUs finished, processing event for a while...\n"); + DC_processMasterEvents(10); + printf("Destroying all WUs...\n"); + for (i= 0; i < nr; i++) + { + printf("%2d\n", i); + DC_destroyWU(wut[i]); + wut[i]= NULL; + } + break; + } } }