}
if( state.COREPROF ) {
+ output.println("#ifdef CP_EVENTID_TASKEXECUTE");
output.println(" CP_LOGEVENT( CP_EVENTID_TASKEXECUTE, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
HashSet<FlatNode> exitset=new HashSet<FlatNode>();
output.println(" SESEcommon* common = (SESEcommon*) "+pair+";");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_BEGIN );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLVAR");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
output.println(" pthread_mutex_lock( &(common->lock) );");
output.println(" while( common->doneExecuting == FALSE ) {");
" = child->"+vst.getAddrVar().getSafeSymbol()+";");
}
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_END );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLVAR");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
output.println(" }");
}
output.println(" if( "+dynVar+"_srcSESE != NULL ) {");
output.println(" SESEcommon* common = (SESEcommon*) "+dynVar+"_srcSESE;");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_BEGIN );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLVAR");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
output.println(" psem_take( &(common->stallSem) );");
" = *(("+typeStr+"*) ("+
dynVar+"_srcSESE + "+dynVar+"_srcOffset));");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_END );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLVAR");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
output.println(" }");
output.println(" }");
output.println(" if(ADDRENTRY(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()
+ "],rentry)==NOTREADY){");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLMEM");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
output.println(" psem_take( &(rentry->parentStallSem) );");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLMEM");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
output.println(" } ");
.println(" if(ADDRENTRY(runningSESE->memoryQueueArray["+ waitingElement.getQueueID()
+ "],rentry)==NOTREADY){");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLMEM");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
output.println(" psem_take( &(rentry->parentStallSem) );");
if( state.COREPROF ) {
- //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
+ output.println("#ifdef CP_EVENTID_TASKSTALLMEM");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
output.println(" } ");
}
output.println(" {");
if( state.COREPROF ) {
- output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_BEGIN );");
+ output.println("#ifdef CP_EVENTID_TASKDISPATCH");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
// before doing anything, lock your own record and increment the running children
// output.println(" pthread_mutex_unlock( &(seseToIssue->common.lock) );");
if( state.COREPROF ) {
- output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_END );");
+ output.println("#ifdef CP_EVENTID_TASKDISPATCH");
+ output.println(" CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
output.println(" }");
}
if( state.COREPROF ) {
+ output.println("#ifdef CP_EVENTID_TASKEXECUTE");
output.println(" CP_LOGEVENT( CP_EVENTID_TASKEXECUTE, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
output.println(" /* SESE exiting */");
if( state.COREPROF ) {
+ output.println("#ifdef CP_EVENTID_TASKRETIRE");
output.println(" CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_BEGIN );");
+ output.println("#endif");
}
String com = paramsprefix+"->common";
// destroy this task's mempool if it is not a leaf task
- output.println( "#ifndef OOO_DISABLE_TASKMEMPOOL" );
if( !fsen.getIsLeafSESE() ) {
+ output.println( "#ifndef OOO_DISABLE_TASKMEMPOOL" );
output.println(" pooldestroy( runningSESE->taskRecordMemPool );");
+ output.println( "#endif" );
}
- output.println( "#endif" );
// if this is not the Main sese (which has no parent) then return
output.println(" runningSESE = (SESEcommon*) 0x1;");
if( state.COREPROF ) {
+ output.println("#ifdef CP_EVENTID_TASKRETIRE");
output.println(" CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_END );");
+ output.println("#endif");
}
}
// point thread lock variable to event monitor
cp_monitor = monitor;
+#ifdef CP_EVENTID_MAIN
CP_LOGEVENT( CP_EVENTID_MAIN, CP_EVENTTYPE_BEGIN );
+#endif
}
// Place to do shutdown stuff
void cp_exit() {
+#ifdef CP_EVENTID_MAIN
CP_LOGEVENT( CP_EVENTID_MAIN, CP_EVENTTYPE_END );
+#endif
}
void cp_writedata( int fd, char* buffer, int count ) {
// the values of the following event types
// and BASESHIFT is for shifting IDs
// past the type bits
+#define CP_EVENTTYPE_BEGIN 0x1
+#define CP_EVENTTYPE_END 0x2
+#define CP_EVENTTYPE_ONEOFF 0x3
+
#define CP_EVENT_MASK 3
#define CP_EVENT_BASESHIFT 8
-#define CP_EVENTTYPE_BEGIN 1
-#define CP_EVENTTYPE_END 2
-#define CP_EVENTTYPE_ONEOFF 3
-
-// Event IDs
-#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
+
+// Event IDs, only those enabled explicitly as a build option
+// will be defined and included in the compilation
+#ifdef cpe_main
+#define CP_EVENTID_MAIN 0x04
+#endif
+
+#ifdef cpe_runmalloc
+#define CP_EVENTID_RUNMALLOC 0x10
+#endif
+
+#ifdef cpe_runfree
+#define CP_EVENTID_RUNFREE 0x11
+#endif
+
+#ifdef cpe_count_poolalloc
+#define CP_EVENTID_COUNT_POOLALLOC 0x15
+#endif
+
+#ifdef cpe_count_poolreuse
+#define CP_EVENTID_COUNT_POOLREUSE 0x16
+#endif
+
+#ifdef cpe_workschedgrab
+#define CP_EVENTID_WORKSCHEDGRAB 0x20
+#endif
+
+#ifdef cpe_taskdispatch
+#define CP_EVENTID_TASKDISPATCH 0x30
+#endif
+
+#ifdef cpe_taskexecute
+#define CP_EVENTID_TASKEXECUTE 0x31
+#endif
+
+#ifdef cpe_taskretire
+#define CP_EVENTID_TASKRETIRE 0x32
+#endif
+
+#ifdef cpe_taskstallvar
+#define CP_EVENTID_TASKSTALLVAR 0x40
+#endif
+
+#ifdef cpe_taskstallmem
+#define CP_EVENTID_TASKSTALLMEM 0x41
+#endif
+
+
// Note: application-specific events (assigned
// during code gen) start at 0x200
static inline void* cp_calloc( int size ) {
- CP_LOGEVENT( CP_EVENTID_RUNMALLOC, CP_EVENTTYPE_BEGIN );
+#ifdef CP_EVENTID_RUNMALLOC
+ CP_LOGEVENT( CP_EVENTID_RUNMALLOC, CP_EVENTTYPE_BEGIN );
+#endif
void* mem = calloc( 1, size );
+#ifdef CP_EVENTID_RUNMALLOC
CP_LOGEVENT( CP_EVENTID_RUNMALLOC, CP_EVENTTYPE_END );
+#endif
return mem;
}
static inline void cp_free( void* ptr ) {
+#ifdef CP_EVENTID_RUNFREE
CP_LOGEVENT( CP_EVENTID_RUNFREE, CP_EVENTTYPE_BEGIN );
+#endif
free( ptr );
+#ifdef CP_EVENTID_RUNFREE
CP_LOGEVENT( CP_EVENTID_RUNFREE, CP_EVENTTYPE_END );
+#endif
}
while( 1 ) {
// wait for work
- //CP_LOGEVENT( CP_EVENTID_WORKSCHEDGRAB, CP_EVENTTYPE_BEGIN );
+#ifdef CP_EVENTID_WORKSCHEDGRAB
+ CP_LOGEVENT( CP_EVENTID_WORKSCHEDGRAB, CP_EVENTTYPE_BEGIN );
+#endif
haveWork = FALSE;
while( !haveWork ) {
pthread_mutex_lock( &systemLockOut );
workUnit = headqi->value;
pthread_mutex_unlock( &systemLockOut );
free( tmp );
- //CP_LOGEVENT( CP_EVENTID_WORKSCHEDGRAB, CP_EVENTTYPE_END );
+#ifdef CP_EVENTID_WORKSCHEDGRAB
+ CP_LOGEVENT( CP_EVENTID_WORKSCHEDGRAB, CP_EVENTTYPE_END );
+#endif
pthread_mutex_lock(&gclistlock);
threadcount++;
BUILDSCRIPT=../../../buildscript
-USEOOO= -ooojava 24 2 -ooodebug
-BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -nooptimize -coreprof -coreprof-checkoverflow -coreprof -coreprof-eventwords 1024*1024*128 -debug #-ooodebug-disable-task-mem-pool
+COREPROFOVERFLOW= -coreprof-checkoverflow
+USECOREPROF= -coreprof $(COREPROFOVERFLOW) \
+ -coreprof-eventwords 1024*1024*128 \
+ -coreprof-enable cpe_main \
+ -coreprof-enable cpe_runmalloc \
+ -coreprof-enable cpe_runfree \
+ -coreprof-enable cpe_count_poolalloc \
+ -coreprof-enable cpe_count_poolreuse \
+ -coreprof-enable cpe_workschedgrab \
+ -coreprof-enable cpe_taskdispatch \
+ -coreprof-enable cpe_taskexecute \
+ -coreprof-enable cpe_taskretire
+# -coreprof-enable cpe_taskstallvar \
+# -coreprof-enable cpe_taskstallmem
+
+
DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determinism
+USEOOO= $(DISJOINT) -ooojava 24 2 -ooodebug $(USECOREPROF)
+
+BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -nooptimize -debug #-ooodebug-disable-task-mem-pool
+
+
all: ooo
remakec:
- $(BUILDSCRIPT) -nojava $(USEOOO) $(BSFLAGS) $(DISJOINT) -o $(PROGRAM)p $(SOURCE_FILES) -builddir par
+ $(BUILDSCRIPT) -nojava $(USEOOO) $(BSFLAGS) -o $(PROGRAM)p $(SOURCE_FILES) -builddir par
single:
$(BUILDSCRIPT) $(BSFLAGS) -thread -o $(PROGRAM)s -builddir sing $(SOURCE_FILES)
ooo:
- $(BUILDSCRIPT) $(USEOOO) $(BSFLAGS) $(DISJOINT) -o $(PROGRAM)p -builddir par $(SOURCE_FILES)
+ $(BUILDSCRIPT) $(USEOOO) $(BSFLAGS) -o $(PROGRAM)p -builddir par $(SOURCE_FILES)
clean:
rm -f $(PROGRAM)p.bin $(PROGRAM)s.bin
echo "-eventmonitor turn on transaction event trace recording"
echo
echo OOOJava options
-echo -coreprof turn on profiling API
-echo -coreprof-eventwords NUM space in words/thread for coreprof events
-echo -coreprof-checkoverflow ONLY use for debugging event overflow
+echo -coreprof, turn on profiling API
+echo -coreprof-eventwords NUM, space in words/thread for coreprof events
+echo -coreprof-checkoverflow, ONLY use for debugging event overflow
+echo -coreprof-enable EVENTNAME, only enable desired events to reduce overhead
+echo EVENTNAME can be: cpe_main, cpe_runmalloc, cpe_runfree, cpe_count_poolalloc, cpe_count_poolreuse, cpe_workschedgrab, cpe_taskdispatch, cpe_taskexecute, cpe_taskretire, cpe_taskstallvar, cpe_taskstallmem
echo "-ooojava <numberofcores> <maxseseage>"
echo -ooodebug general OOOJava debugging messages
echo -ooodebug-disable-task-mem-pool this is a tricky module, disable for simpler runtime
then
EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPROF_CHECKOVERFLOW"
+elif [[ $1 = '-coreprof-enable' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -D$2"
+shift
+
elif [[ $1 = '-mlp' ]]
then
MLP_ON=true
EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC"
fi
+echo Compiling C...
+echo EXTRAOPTIONS=$EXTRAOPTIONS
+
if $ASSEMBLY
then
gcc -S $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \