return new Integer( uniqueIDcount );
}
+ public int getUniqueAllocSiteID() {
+ return id;
+ }
+
public String getDisjointAnalysisId() {
return disjointId;
}
outclassdefs.println(" int type;");
if(state.MLP || state.OOOJAVA ){
outclassdefs.println(" int oid;");
+ outclassdefs.println(" int allocsite;");
}
if (state.EVENTMONITOR) {
outclassdefs.println(" int objuid;");
classdefout.println(" int type;");
if(state.MLP || state.OOOJAVA){
classdefout.println(" int oid;");
+ classdefout.println(" int allocsite;");
}
if (state.EVENTMONITOR) {
classdefout.println(" int objuid;");
) {
outmethod.println( " /* work scheduler works forever, explicitly exit */");
if (state.COREPROF) {
- outmethod.println("EXITPROFILER();");
- outmethod.println("DUMPPROFILER();");
+ outmethod.println("CP_EXIT();");
+ outmethod.println("CP_DUMP();");
}
outmethod.println( " exit( 0 );");
}
cp = oooa.getCodePlan(fn);
}
- if( cp != null ) {
+ if( cp != null ) {
FlatSESEEnterNode currentSESE = cp.getCurrentSESE();
output.println(" {");
output.println(" SESEcommon* common = (SESEcommon*) "+pair+";");
-
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_BEGIN );");
output.println(" pthread_mutex_lock( &(common->lock) );");
output.println(" while( common->doneExecuting == FALSE ) {");
output.println(" pthread_cond_wait( &(common->doneCond), &(common->lock) );");
// copy things we might have stalled for
output.println(" "+pair.getSESE().getSESErecordName()+"* child = ("+
- pair.getSESE().getSESErecordName()+"*) "+pair+";");
+ pair.getSESE().getSESErecordName()+"*) "+pair+";");
Iterator<TempDescriptor> tdItr = cp.getCopySet( vst ).iterator();
while( tdItr.hasNext() ) {
" = child->"+vst.getAddrVar().getSafeSymbol()+";");
}
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_END );");
output.println(" }");
}
// otherwise the dynamic write nodes will have the local var up-to-date
output.println(" {");
output.println(" if( "+dynVar+"_srcSESE != NULL ) {");
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_BEGIN );");
output.println(" SESEcommon* common = (SESEcommon*) "+dynVar+"_srcSESE;");
output.println(" psem_take( &(common->stallSem) );");
}
TypeDescriptor type=dynVar.getType();
- String typeStr;
- if( type.isNull() ) {
- typeStr = "void*";
- } else if( type.isClass() || type.isArray() ) {
- typeStr = "struct "+type.getSafeSymbol()+"*";
- } else {
- typeStr = type.getSafeSymbol();
- }
+ String typeStr;
+ if( type.isNull() ) {
+ typeStr = "void*";
+ } else if( type.isClass() || type.isArray() ) {
+ typeStr = "struct "+type.getSafeSymbol()+"*";
+ } else {
+ typeStr = type.getSafeSymbol();
+ }
output.println(" "+generateTemp( fmContext, dynVar, null )+
- " = *(("+typeStr+"*) ("+
- dynVar+"_srcSESE + "+dynVar+"_srcOffset));");
-
+ " = *(("+typeStr+"*) ("+
+ dynVar+"_srcSESE + "+dynVar+"_srcOffset));");
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLVAR, CP_EVENTTYPE_END );");
output.println(" }");
output.println(" }");
}
output.println(" "+dynVar+"_srcSESE = NULL;");
}
- // eom
- // handling stall site
- if (state.OOOJAVA) {
- Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE);
- if(graph!=null){
- Set<Analysis.OoOJava.SESELock> seseLockSet = oooa.getLockMappings(graph);
- Set<Analysis.OoOJava.WaitingElement> waitingElementSet =
- graph.getStallSiteWaitingElementSet(fn, seseLockSet);
+ // eom
+ // handling stall site
+ if (state.OOOJAVA) {
+ Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE);
+ if(graph!=null){
+ Set<Analysis.OoOJava.SESELock> seseLockSet = oooa.getLockMappings(graph);
+ Set<Analysis.OoOJava.WaitingElement> waitingElementSet =
+ graph.getStallSiteWaitingElementSet(fn, seseLockSet);
- if(waitingElementSet.size()>0){
- output.println("// stall on parent's stall sites ");
- output.println(" {");
- output.println(" REntry* rentry;");
+ if(waitingElementSet.size()>0){
+ output.println("// stall on parent's stall sites ");
+ output.println(" {");
+ output.println(" REntry* rentry;");
- for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
- Analysis.OoOJava.WaitingElement waitingElement = (Analysis.OoOJava.WaitingElement) iterator.next();
+ for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
+ Analysis.OoOJava.WaitingElement waitingElement = (Analysis.OoOJava.WaitingElement) iterator.next();
- if( waitingElement.getStatus() >= ConflictNode.COARSE ){
- output.println(" rentry=mlpCreateREntry("+ waitingElement.getStatus()+ ", seseCaller);");
- }else{
- output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", seseCaller, (void*)&" +generateTemp(fm,waitingElement.getTempDesc(),lb)+ ");");
- }
- output.println(" psem_init( &(rentry->parentStallSem) );");
- output.println(" rentry->queue=seseCaller->memoryQueueArray["+ waitingElement.getQueueID()+ "];");
- output
- .println(" if(ADDRENTRY(seseCaller->memoryQueueArray["+ waitingElement.getQueueID()
- + "],rentry)==NOTREADY){");
- output.println(" psem_take( &(rentry->parentStallSem) );");
- output.println(" } ");
+ if( waitingElement.getStatus() >= ConflictNode.COARSE ){
+ output.println(" rentry=mlpCreateREntry("+ waitingElement.getStatus()+ ", seseCaller);");
+ }else{
+ output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", seseCaller, (void*)&" +generateTemp(fm,waitingElement.getTempDesc(),lb)+ ");");
+ }
+ output.println(" psem_init( &(rentry->parentStallSem) );");
+ output.println(" rentry->queue=seseCaller->memoryQueueArray["+ waitingElement.getQueueID()+ "];");
+ output
+ .println(" if(ADDRENTRY(seseCaller->memoryQueueArray["+ waitingElement.getQueueID()
+ + "],rentry)==NOTREADY){");
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
+ output.println(" psem_take( &(rentry->parentStallSem) );");
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
+ output.println(" } ");
+ }
+ output.println(" }");
+ }
}
- output.println(" }");
- }
- }
- }else{
- ParentChildConflictsMap conflictsMap = mlpa.getConflictsResults().get(fn);
- if (conflictsMap != null) {
- Set<Long> allocSet = conflictsMap.getAllocationSiteIDSetofStallSite();
- if (allocSet.size() > 0) {
- FlatNode enclosingFlatNode=null;
- if( currentSESE.getIsCallerSESEplaceholder() && currentSESE.getParent()==null){
- enclosingFlatNode=currentSESE.getfmEnclosing();
- }else{
- enclosingFlatNode=currentSESE;
- }
- ConflictGraph graph=mlpa.getConflictGraphResults().get(enclosingFlatNode);
- HashSet<SESELock> seseLockSet=mlpa.getConflictGraphLockMap().get(graph);
- Set<WaitingElement> waitingElementSet=graph.getStallSiteWaitingElementSet(conflictsMap, seseLockSet);
+ }else{
+ ParentChildConflictsMap conflictsMap = mlpa.getConflictsResults().get(fn);
+ if (conflictsMap != null) {
+ Set<Long> allocSet = conflictsMap.getAllocationSiteIDSetofStallSite();
+ if (allocSet.size() > 0) {
+ FlatNode enclosingFlatNode=null;
+ if( currentSESE.getIsCallerSESEplaceholder() && currentSESE.getParent()==null){
+ enclosingFlatNode=currentSESE.getfmEnclosing();
+ }else{
+ enclosingFlatNode=currentSESE;
+ }
+ ConflictGraph graph=mlpa.getConflictGraphResults().get(enclosingFlatNode);
+ HashSet<SESELock> seseLockSet=mlpa.getConflictGraphLockMap().get(graph);
+ Set<WaitingElement> waitingElementSet=graph.getStallSiteWaitingElementSet(conflictsMap, seseLockSet);
- if(waitingElementSet.size()>0){
- output.println("// stall on parent's stall sites ");
- output.println(" {");
- output.println(" REntry* rentry;");
+ if(waitingElementSet.size()>0){
+ output.println("// stall on parent's stall sites ");
+ output.println(" {");
+ output.println(" REntry* rentry;");
- for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
- WaitingElement waitingElement = (WaitingElement) iterator.next();
+ for (Iterator iterator = waitingElementSet.iterator(); iterator.hasNext();) {
+ WaitingElement waitingElement = (WaitingElement) iterator.next();
- if( waitingElement.getStatus() >= ConflictNode.COARSE ){
- output.println(" rentry=mlpCreateREntry("+ waitingElement.getStatus()+ ", seseCaller);");
- }else{
- output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", seseCaller, (void*)&___locals___."+ waitingElement.getDynID() + ");");
- // output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", seseCaller, ___locals___."+ waitingElement.getDynID() + "->oid);");
- }
- output.println(" psem_init( &(rentry->parentStallSem) );");
- output.println(" rentry->queue=seseCaller->memoryQueueArray["+ waitingElement.getQueueID()+ "];");
- output
- .println(" if(ADDRENTRY(seseCaller->memoryQueueArray["+ waitingElement.getQueueID()
- + "],rentry)==NOTREADY){");
- output.println(" psem_take( &(rentry->parentStallSem) );");
- output.println(" } ");
- }
- output.println(" }");
- }
- }
- }
+ if( waitingElement.getStatus() >= ConflictNode.COARSE ){
+ output.println(" rentry=mlpCreateREntry("+ waitingElement.getStatus()+ ", seseCaller);");
+ }else{
+ output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", seseCaller, (void*)&___locals___."+ waitingElement.getDynID() + ");");
+ // output.println(" rentry=mlpCreateFineREntry("+ waitingElement.getStatus()+ ", seseCaller, ___locals___."+ waitingElement.getDynID() + "->oid);");
+ }
+ output.println(" psem_init( &(rentry->parentStallSem) );");
+ output.println(" rentry->queue=seseCaller->memoryQueueArray["+ waitingElement.getQueueID()+ "];");
+ output
+ .println(" if(ADDRENTRY(seseCaller->memoryQueueArray["+ waitingElement.getQueueID()
+ + "],rentry)==NOTREADY){");
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_BEGIN );");
+ output.println(" psem_take( &(rentry->parentStallSem) );");
+ //output.println(" CP_LOGEVENT( CP_EVENTID_TASKSTALLMEM, CP_EVENTTYPE_END );");
+ output.println(" } ");
+ }
+ output.println(" }");
+ }
+ }
+ }
}
-
-
- }
+ }
}
switch(fn.kind()) {
output.println(" {");
+
+ //output.println("CP_LOGEVENT( CP_EVENTID_TASKDISPATCH, CP_EVENTTYPE_BEGIN );");
+
// set up the parent
if( (state.MLP && fsen == mlpa.getMainSESE()) ||
(state.OOOJAVA && fsen == oooa.getMainSESE())
// release this SESE for siblings to update its dependencies or,
// eventually, for it to mark itself finished
// output.println(" pthread_mutex_unlock( &(seseToIssue->common.lock) );");
+
+
+ //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();
// data has been taken care of--set sese pointer to remember self over method
// calls to a non-zero, invalid address
output.println(" seseCaller = (SESEcommon*) 0x1;");
-
+
+
+ //output.println("CP_LOGEVENT( CP_EVENTID_TASKRETIRE, CP_EVENTTYPE_END );");
}
public void generateFlatWriteDynamicVarNode( FlatMethod fm,
output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarrayglobal("+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
} else if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
if(this.state.MLP || state.OOOJAVA){
- output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray_oid("+localsprefixaddr+", "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+", oid);");
+ output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray_mlp("+localsprefixaddr+", "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+", oid, "+oooa.getDisjointAnalysis().getAllocationSiteFromFlatNew(fn).getUniqueAllocSiteID()+");");
output.println(" oid += numWorkers;");
}else{
output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray("+localsprefixaddr+", "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");");
output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newglobal("+fn.getType().getClassDesc().getId()+");");
} else if ((GENERATEPRECISEGC) || (this.state.MULTICOREGC)) {
if (this.state.MLP || state.OOOJAVA){
- output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new_oid("+localsprefixaddr+", "+fn.getType().getClassDesc().getId()+", oid);");
+ output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new_mlp("+localsprefixaddr+", "+fn.getType().getClassDesc().getId()+", oid, "+oooa.getDisjointAnalysis().getAllocationSiteFromFlatNew(fn).getUniqueAllocSiteID()+");");
output.println(" oid += numWorkers;");
} else {
output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new("+localsprefixaddr+", "+fn.getType().getClassDesc().getId()+");");
#include <stdlib.h>
#include "mlp_lock.h"
-__thread struct coreprofmonitor * cp_events=NULL;
-struct coreprofmonitor * cp_eventlist=NULL;
-static volatile int cp_threadcount=0;
-__thread int cp_threadnum;
+__thread int cp_threadnum;
+__thread struct coreprofmonitor* cp_monitor = NULL;
+ struct coreprofmonitor* cp_monitorList = NULL;
+static volatile int cp_threadCount = 0;
+
static inline int atomicinc(volatile int *lock) {
int retval=1;
}
-//Need to have global lock before calling this method
-void createprofiler() {
- if (cp_events!=NULL)
+// Need to have global lock before calling this method
+void cp_create() {
+ if( cp_monitor != NULL )
return;
- struct coreprofmonitor *event=calloc(1, sizeof(struct coreprofmonitor));
- //add new eventmonitor to list
- struct coreprofmonitor *tmp;
- //add ourself to the list
+ struct coreprofmonitor* monitor =
+ calloc( 1, sizeof( struct coreprofmonitor ) );
+
+ struct coreprofmonitor* tmp;
+
+ // add ourself to the list
do {
- tmp=cp_eventlist;
- event->next=tmp;
- } while(CAS(&cp_eventlist, (INTPTR) tmp, (INTPTR) event)!=((INTPTR)tmp));
+ tmp = cp_monitorList;
+ monitor->next = tmp;
+ } while( CAS( &cp_monitorList,
+ (INTPTR) tmp,
+ (INTPTR) monitor
+ ) != ((INTPTR)tmp)
+ );
- int ourcount=atomicinc(&cp_threadcount);
- cp_threadnum=ourcount;
+ int ourcount = atomicinc( &cp_threadCount );
+ cp_threadnum = ourcount;
- //point thread lock variable to eventmonitor
- cp_events=event;
- CPLOGEVENT(CP_MAIN, CP_BEGIN);
+ // point thread lock variable to event monitor
+ cp_monitor = monitor;
+ CP_LOGEVENT( CP_EVENTID_MAIN, CP_EVENTTYPE_BEGIN );
}
-//Place to do shutdown stuff
-void exitprofiler() {
- CPLOGEVENT(CP_MAIN, CP_END);
+// Place to do shutdown stuff
+void cp_exit() {
+ CP_LOGEVENT( CP_EVENTID_MAIN, CP_EVENTTYPE_END );
}
-void cpwritedata(int fd, char * buffer, int count) {
- int offset=0;
- while(count>0) {
- int size=write(fd, &buffer[offset], count);
- offset+=size;
- count-=size;
+void cp_writedata( int fd, char* buffer, int count ) {
+ int offset = 0;
+ while( count > 0 ) {
+ int size = write( fd, &buffer[offset], count );
+ offset += size;
+ count -= size;
}
}
-void dumpprofiler() {
- int fd=open("logdata",O_RDWR|O_CREAT,S_IRWXU);
- int count=0;
- struct coreprofmonitor * ptr=cp_eventlist;
- int version=0;
- //Write version number
- cpwritedata(fd, (char *)&version, sizeof(int));
- while(ptr!=NULL) {
+
+void cp_dump() {
+
+ //int fdh = open( "coreprof-head.dat", O_RDWR | O_CREAT, S_IRWXU );
+ //int fde = open( "coreprof-evnt.dat", O_RDWR | O_CREAT, S_IRWXU );
+ //int fdt = open( "coreprof-time.dat", O_RDWR | O_CREAT, S_IRWXU );
+ int fd = open( "coreprof.dat", O_RDWR | O_CREAT, S_IRWXU );
+ int count = 0;
+ int i;
+
+ struct coreprofmonitor* monitor;
+
+ // WRITING HEADER
+
+ // Write version number
+ int version = 0;
+ cp_writedata( fd,
+ (char*)&version,
+ sizeof( int ) );
+
+ // check for overflow
+ monitor = cp_monitorList;
+ while( monitor != NULL ) {
count++;
- if (ptr->index>CPMAXEVENTS) {
- printf("ERROR: EVENT COUNT EXCEEDED\n");
+ if( monitor->numEvents > CP_MAXEVENTS ) {
+ printf( "ERROR: EVENT COUNT EXCEEDED\n" );
}
- ptr=ptr->next;
+ monitor = monitor->next;
+ }
+
+ // Write the number of threads
+ cp_writedata( fd,
+ (char*)&count,
+ sizeof( int ) );
+
+ monitor = cp_monitorList;
+ while( monitor != NULL ) {
+
+ // Write the number of events for each thread
+ cp_writedata( fd,
+ (char*)&monitor->numEvents,
+ sizeof( int ) );
+
+ monitor = monitor->next;
}
- //Write the number of threads
- cpwritedata(fd, (char *)&count, sizeof(int));
+ // END HEADER, BEGIN DATA
+
+ monitor = cp_monitorList;
+ while( monitor != NULL ) {
- //Write the number of events for each thread
- ptr=cp_eventlist;
- while(ptr!=NULL) {
- cpwritedata(fd, (char *)&ptr->index, sizeof(int));
- ptr=ptr->next;
+ // Write the event IDs (index matches time below)
+ cp_writedata( fd,
+ (char*)monitor->events,
+ sizeof( unsigned int )*monitor->numEvents );
+
+ // Write the event timestamps (index matches above)
+ cp_writedata( fd,
+ (char*)monitor->logTimes_ms,
+ sizeof( long long )*monitor->numEvents );
+ monitor = monitor->next;
}
- //Dump the data
- ptr=cp_eventlist;
- while(ptr!=NULL) {
- cpwritedata(fd, (char *) ptr->value, sizeof(int)*ptr->index);
- ptr=ptr->next;
- }
- close(fd);
+ close( fd );
+ //close( fde );
+ //close( fdt );
+}
+
+
+void cp_reportOverflow() {
+ printf( "ERROR: coreprof event overflow\n" );
+ exit( -1 );
}
#ifndef COREPROF_H
#define COREPROF_H
+
+
#ifndef COREPROF
+// Core Prof turned off
+
+#define CP_LOGEVENT( eventID, eventType ) ;
+#define CP_CREATE() ;
+#define CP_EXIT() ;
+#define CP_DUMP() ;
+
-//Core Prof turned off
-#define CREATEPROFILER() ;
-#define EXITPROFILER() ;
-#define DUMPPROFILER() ;
-#define CPLOGEVENT(x,y) ;
#else
+// Core Prof defined
+
#include <stdlib.h>
#include "runtime.h"
-//Core Prof defined
-#ifndef CPMAXEVENTS
-#define CPMAXEVENTS (1024*1024*128)
+
+#ifndef CP_MAXEVENTS
+#define CP_MAXEVENTS (1024*1024*128)
#endif
-#define CREATEPROFILER() createprofiler();
-#define EXITPROFILER() exitprofiler();
-#define DUMPPROFILER() dumpprofiler();
-#define CPLOGEVENT(x,y) { cp_events->value[cp_events->index++]=((x<<CP_BASE_SHIFT)|y); \
- CPLOGTIME \
- }
+// MASK should be enough bits to mask
+// the values of the following event types
+// and BASESHIFT is for shifting IDs
+// past the type bits
+#define CP_EVENT_MASK 3
+#define CP_EVENT_BASESHIFT 2
-#define CP_BEGIN 0
-#define CP_END 1
-#define CP_EVENT 2
-#define CP_MASK 3
-#define CP_BASE_SHIFT 2
+#define CP_EVENTTYPE_BEGIN 0
+#define CP_EVENTTYPE_END 1
+#define CP_EVENTTYPE_ONEOFF 2
-#define CP_MAIN 0
-#define CP_RUNMALLOC 1
-#define CP_RUNFREE 1
+// Event IDs
+#define CP_EVENTID_MAIN 0
+#define CP_EVENTID_RUNMALLOC 1
+#define CP_EVENTID_RUNFREE 2
+#define CP_EVENTID_TASKDISPATCH 3
+#define CP_EVENTID_TASKRETIRE 4
+#define CP_EVENTID_TASKSTALLVAR 5
+#define CP_EVENTID_TASKSTALLMEM 6
-#define CPLOGTIME *((long long *)&cp_events->value[cp_events->index])=rdtsc(); \
- cp_events->index+=2;
struct coreprofmonitor {
- int index;
- struct coreprofmonitor * next;
- unsigned int value[CPMAXEVENTS];
+ struct coreprofmonitor* next;
+
+ // index for next empty slot in the following arrays
+ int numEvents;
+ unsigned int events [CP_MAXEVENTS];
+ long long logTimes_ms[CP_MAXEVENTS];
};
-extern __thread int cp_threadnum;
-extern __thread struct coreprofmonitor * cp_events;
-extern struct coreprofmonitor * cp_eventlist;
-void createprofiler();
-void exitprofiler();
-void dumpprofiler();
-
-static inline void *cp_calloc(int size) {
- CPLOGEVENT(CP_RUNMALLOC, CP_BEGIN);
- void *mem=calloc(1,size);
- CPLOGEVENT(CP_RUNMALLOC, CP_END);
+
+extern __thread int cp_threadnum;
+extern __thread struct coreprofmonitor* cp_monitor;
+extern struct coreprofmonitor* cp_monitorList;
+
+
+#ifndef COREPROF_CHECKOVERFLOW
+// normal, no overflow check version
+#define CP_LOGEVENT( eventID, eventType ) { \
+ cp_monitor->events[cp_monitor->numEvents] = \
+ ((eventID<<CP_EVENT_BASESHIFT)|eventType); \
+ cp_monitor->logTimes_ms[cp_monitor->numEvents] = rdtsc(); \
+ cp_monitor->numEvents++; \
+}
+#else
+// check for event overflow, DEBUG ONLY!
+void cp_reportOverflow();
+#define CP_LOGEVENT( eventID, eventType ) { \
+ if( cp_monitor->numEvents == CP_MAXEVENTS ) \
+ { cp_reportOverflow(); } \
+ cp_monitor->events[cp_monitor->numEvents] = \
+ ((eventID<<CP_EVENT_BASESHIFT)|eventType); \
+ cp_monitor->logTimes_ms[cp_monitor->numEvents] = rdtsc(); \
+ cp_monitor->numEvents++; \
+}
+#endif
+
+
+#define CP_CREATE() cp_create();
+#define CP_EXIT() cp_exit();
+#define CP_DUMP() cp_dump();
+
+void cp_create();
+void cp_exit();
+void cp_dump();
+
+
+
+static inline void* cp_calloc( int size ) {
+ //CP_LOGEVENT( CP_EVENTID_RUNMALLOC, CP_EVENTTYPE_BEGIN );
+ void* mem = calloc( 1, size );
+ //CP_LOGEVENT( CP_EVENTID_RUNMALLOC, CP_EVENTTYPE_END );
return mem;
}
-static inline void cp_free(void *ptr) {
- CPLOGEVENT(CP_RUNFREE, CP_BEGIN);
- free(ptr);
- CPLOGEVENT(CP_RUNFREE, CP_END);
+static inline void cp_free( void* ptr ) {
+ //CP_LOGEVENT( CP_EVENTID_RUNFREE, CP_EVENTTYPE_BEGIN );
+ free( ptr );
+ //CP_LOGEVENT( CP_EVENTID_RUNFREE, CP_EVENTTYPE_END );
}
+
+
#endif
#endif
#if defined(PRECISE_GC)
#ifdef MLP
__attribute__((malloc)) void * allocate_new(void * ptr, int type) {
- return allocate_new_oid(ptr, type, 0);
+ return allocate_new_mlp(ptr, type, 0, 0);
}
-__attribute__((malloc)) void * allocate_new_oid(void * ptr, int type, int oid) {
+__attribute__((malloc)) void * allocate_new_mlp(void * ptr, int type, int oid, int allocsite) {
#else
__attribute__((malloc)) void * allocate_new(void * ptr, int type) {
#endif
#endif
#ifdef MLP
v->oid=oid;
+ v->allocsite=allocsite;
#endif
return v;
}
/* Array allocation function */
#ifdef MLP
__attribute__((malloc)) struct ArrayObject * allocate_newarray(void * ptr, int type, int length) {
- return allocate_newarray_oid(ptr, type, length, 0);
+ return allocate_newarray_mlp(ptr, type, length, 0, 0);
}
- __attribute__((malloc)) struct ArrayObject * allocate_newarray_oid(void * ptr, int type, int length, int oid) {
+ __attribute__((malloc)) struct ArrayObject * allocate_newarray_mlp(void * ptr, int type, int length, int oid, int allocsite) {
#else
__attribute__((malloc)) struct ArrayObject * allocate_newarray(void * ptr, int type, int length) {
#endif
#endif
#ifdef MLP
v->oid=oid;
+ v->allocsite=allocsite;
#endif
return v;
}
#ifdef PRECISE_GC
#include "garbage.h"
#ifdef MLP
-__attribute__((malloc)) void * allocate_new_oid(void *, int type, int oid);
+__attribute__((malloc)) void * allocate_new_mlp(void *, int type, int oid, int allocsite);
__attribute__((malloc)) void * allocate_new(void *, int type);
-__attribute__((malloc)) struct ArrayObject * allocate_newarray_oid(void *, int type, int length, int oid);
+__attribute__((malloc)) struct ArrayObject * allocate_newarray_mlp(void *, int type, int length, int oid, int allocsite);
__attribute__((malloc)) struct ArrayObject * allocate_newarray(void * ptr, int type, int length);
#else
__attribute__((malloc)) void * allocate_new(void *, int type);
void* workUnit;
WorkerData* myData = (WorkerData*) arg;
//Start profiler
- CREATEPROFILER();
+ CP_CREATE();
oid=myData->id;
// make sure init mlp once-per-thread stuff
}
pthread_mutex_unlock(&gclistlock);
}
- EXITPROFILER();
+
+ CP_EXIT();
+
return NULL;
}
void workScheduleInit( int numProcessors,
void(*func)(void*) ) {
int i, status;
- CREATEPROFILER();
+
+ CP_CREATE();
+
pthread_mutex_init(&gclock, NULL);
pthread_mutex_init(&gclistlock, NULL);
pthread_cond_init(&gccond, NULL);
echo
echo OOOJava options
echo -coreprof turn on profiling API
+echo -coreprof-checkoverflow ONLY use for debugging event overflow
echo "-ooojava <numberofcores> <maxseseage>"
echo -ooodebug general OOOJava debugging messages
echo -rcr turn on runtime conflict resolver
JAVAOPTS="$JAVAOPTS -coreprof"
EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPROF -I$ROBUSTROOT/Runtime/coreprof"
+elif [[ $1 = '-coreprof-checkoverflow' ]]
+then
+EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPROF_CHECKOVERFLOW"
+
elif [[ $1 = '-mlp' ]]
then
MLP_ON=true