From: jjenista <jjenista> Date: Fri, 10 Sep 2010 19:44:11 +0000 (+0000) Subject: task execute, dispatch, reture and work grabbing events debugged X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=928c893c2634a3e3e8e10b71f51f8c1a9a9585e1;p=IRC.git task execute, dispatch, reture and work grabbing events debugged --- diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index d5729c55..6f002a13 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -2379,6 +2379,10 @@ public class BuildCode { // initialize thread-local var to a non-zero, invalid address output.println(" seseCaller = (SESEcommon*) 0x2;"); + + + output.println(" CP_LOGEVENT( CP_EVENTID_TASKEXECUTE, CP_EVENTTYPE_BEGIN );"); + HashSet<FlatNode> exitset=new HashSet<FlatNode>(); exitset.add(seseExit); generateCode(fsen.getNext(0), fm, null, exitset, output, true); @@ -3570,7 +3574,7 @@ public class BuildCode { output.println(" {"); - //output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_BEGIN );"); + output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_BEGIN );"); // set up the parent if( (state.MLP && fsen == mlpa.getMainSESE()) || @@ -4075,7 +4079,7 @@ public class BuildCode { // output.println(" pthread_mutex_unlock( &(seseToIssue->common.lock) );"); - //output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_END );"); + output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_END );"); output.println(" }"); @@ -4093,8 +4097,6 @@ public class BuildCode { return; } - //output.println("CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_BEGIN );"); - // get the enter node for this exit that has meta data embedded FlatSESEEnterNode fsen = fsexn.getFlatEnter(); @@ -4110,7 +4112,10 @@ public class BuildCode { return; } + output.println(" CP_LOGEVENT( CP_EVENTID_TASKEXECUTE, CP_EVENTTYPE_END );"); + output.println(" /* SESE exiting */"); + output.println(" CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_BEGIN );"); String com = paramsprefix+"->common"; @@ -4248,7 +4253,7 @@ public class BuildCode { output.println(" seseCaller = (SESEcommon*) 0x1;"); - //output.println("CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_END );"); + output.println(" CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_END );"); } public void generateFlatWriteDynamicVarNode( FlatMethod fm, diff --git a/Robust/src/Runtime/coreprof/coreprof.h b/Robust/src/Runtime/coreprof/coreprof.h index 97f5749b..ad90a68b 100644 --- a/Robust/src/Runtime/coreprof/coreprof.h +++ b/Robust/src/Runtime/coreprof/coreprof.h @@ -34,15 +34,17 @@ #define CP_EVENTTYPE_ONEOFF 3 // Event IDs -#define CP_EVENTID_MAIN 0x04 -#define CP_EVENTID_RUNMALLOC 0x05 -#define CP_EVENTID_RUNFREE 0x06 -#define CP_EVENTID_TASKDISPATCH 0x07 -#define CP_EVENTID_TASKRETIRE 0x08 -#define CP_EVENTID_TASKSTALLVAR 0x09 -#define CP_EVENTID_TASKSTALLMEM 0x0a +#define CP_EVENTID_MAIN 0x04 +#define CP_EVENTID_RUNMALLOC 0x10 +#define CP_EVENTID_RUNFREE 0x11 +#define CP_EVENTID_WORKSCHEDGRAB 0x20 +#define CP_EVENTID_TASKDISPATCH 0x30 +#define CP_EVENTID_TASKEXECUTE 0x31 +#define CP_EVENTID_TASKRETIRE 0x32 +#define CP_EVENTID_TASKSTALLVAR 0x40 +#define CP_EVENTID_TASKSTALLMEM 0x41 // Note: application-specific events (assigned -// during code gen) start at 0x100 +// during code gen) start at 0x200 diff --git a/Robust/src/Runtime/workschedule.c b/Robust/src/Runtime/workschedule.c index 9375b431..305a2a4e 100644 --- a/Robust/src/Runtime/workschedule.c +++ b/Robust/src/Runtime/workschedule.c @@ -63,6 +63,7 @@ void* workerMain( void* arg ) { void* workUnit; WorkerData* myData = (WorkerData*) arg; int oldState; + int haveWork; // once-per-thread stuff CP_CREATE(); @@ -77,18 +78,25 @@ void* workerMain( void* arg ) { // then continue to process work while( 1 ) { - pthread_mutex_lock( &systemLockOut ); // wait for work - if (headqi->next==NULL) { - pthread_mutex_unlock( &systemLockOut ); - sched_yield(); - continue; + CP_LOGEVENT( CP_EVENTID_WORKSCHEDGRAB, CP_EVENTTYPE_BEGIN ); + haveWork = FALSE; + while( !haveWork ) { + pthread_mutex_lock( &systemLockOut ); + if( headqi->next == NULL ) { + pthread_mutex_unlock( &systemLockOut ); + sched_yield(); + continue; + } else { + haveWork = TRUE; + } } struct QI * tmp=headqi; headqi = headqi->next; workUnit = headqi->value; pthread_mutex_unlock( &systemLockOut ); - free(tmp); + free( tmp ); + CP_LOGEVENT( CP_EVENTID_WORKSCHEDGRAB, CP_EVENTTYPE_END ); pthread_mutex_lock(&gclistlock); threadcount++;