// 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);
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()) ||
// 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(" }");
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();
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";
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,
#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
void* workUnit;
WorkerData* myData = (WorkerData*) arg;
int oldState;
+ int haveWork;
// once-per-thread stuff
CP_CREATE();
// 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++;