From: jzhou Date: Tue, 4 Nov 2008 18:44:41 +0000 (+0000) Subject: add precise profiling data for multicore version profiling X-Git-Tag: buildscript^7~61 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f07dc41f75c81fe305137bf65ad07cdcc9168962;p=IRC.git add precise profiling data for multicore version profiling --- diff --git a/Robust/src/Analysis/Scheduling/ScheduleEdge.java b/Robust/src/Analysis/Scheduling/ScheduleEdge.java index 5496ff96..1d2ec6a1 100644 --- a/Robust/src/Analysis/Scheduling/ScheduleEdge.java +++ b/Robust/src/Analysis/Scheduling/ScheduleEdge.java @@ -26,7 +26,7 @@ public class ScheduleEdge extends Edge { private ClassNode sourceCNode; private ClassNode targetCNode; - private int probability; + private double probability; private int transTime; private int listExeTime; @@ -77,7 +77,7 @@ public class ScheduleEdge extends Edge { if(ScheduleEdge.NEWEDGE == this.type) { completeLabel += ":" + Integer.toString(this.newRate); } - completeLabel += ":(" + Integer.toString(this.probability) + "%)" + ":[" + Integer.toString(this.transTime) + "]"; + completeLabel += ":(" + Double.toString(this.probability) + "%)" + ":[" + Integer.toString(this.transTime) + "]"; return completeLabel; } @@ -108,7 +108,7 @@ public class ScheduleEdge extends Edge { return this.targetFState; } - public int getProbability() { + public double getProbability() { return this.probability; } @@ -170,7 +170,7 @@ public class ScheduleEdge extends Edge { public int hashCode() { int hashcode = gid^uid^label.hashCode()^target.hashCode()^source.hashCode()^fstate.hashCode()^ - sourceCNode.hashCode()^targetCNode.hashCode()^newRate^probability^ + sourceCNode.hashCode()^targetCNode.hashCode()^newRate^(int)probability^ type^transTime^listExeTime; if(targetFState != null) { hashcode ^= targetFState.hashCode(); @@ -181,7 +181,7 @@ public class ScheduleEdge extends Edge { return hashcode; } - public void setProbability(int prob) { + public void setProbability(double prob) { this.probability = prob; } diff --git a/Robust/src/Analysis/Scheduling/ScheduleSimulator.java b/Robust/src/Analysis/Scheduling/ScheduleSimulator.java index fe80bc83..49c063df 100644 --- a/Robust/src/Analysis/Scheduling/ScheduleSimulator.java +++ b/Robust/src/Analysis/Scheduling/ScheduleSimulator.java @@ -105,6 +105,9 @@ public class ScheduleSimulator { this.cores.add(new CoreSimulator(FIFORSchedule.getFIFORSchedule(), i)); } } + if(this.checkpoints != null) { + this.checkpoints.clear(); + } applyScheduling(); } @@ -140,9 +143,9 @@ public class ScheduleSimulator { if(this.checkpoints == null) { this.checkpoints = new Vector(); - } else { + } /*else { this.checkpoints.clear(); - } + }*/ this.processTime = 0; @@ -385,6 +388,9 @@ public class ScheduleSimulator { for(int j = 0; j < this.cores.size(); j++) { System.out.println("\t\tcore" + j + ": " + getUtility(j) + "%"); } + + this.checkpoints.clear(); + this.checkpoints = null; return this.processTime; } diff --git a/Robust/src/Analysis/TaskStateAnalysis/FEdge.java b/Robust/src/Analysis/TaskStateAnalysis/FEdge.java index cb471860..c998d70c 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/FEdge.java +++ b/Robust/src/Analysis/TaskStateAnalysis/FEdge.java @@ -18,10 +18,11 @@ public class FEdge extends Edge { private int invokeNum; private int expInvokeNum; private boolean m_isbackedge; + private int m_taskexitindex; public class NewObjInfo { int newRate; - int probability; + double probability; FlagState root; int invokeNum; @@ -32,7 +33,7 @@ public class FEdge extends Edge { invokeNum = 0; } - public NewObjInfo(int newRate, int probability) { + public NewObjInfo(int newRate, double probability) { this.newRate = newRate; this.probability = probability; } @@ -45,11 +46,11 @@ public class FEdge extends Edge { this.newRate = newRate; } - public int getProbability() { + public double getProbability() { return this.probability; } - public void setProbability(int probability) { + public void setProbability(double probability) { this.probability = probability; } @@ -97,6 +98,15 @@ public class FEdge extends Edge { this.invokeNum = 0; this.expInvokeNum = 0; this.m_isbackedge = false; + this.m_taskexitindex = 0; + } + + public int getTaskExitIndex() { + return m_taskexitindex; + } + + public void setTaskExitIndex(int taskexitindex) { + this.m_taskexitindex = taskexitindex; } public double getProbability() { @@ -178,7 +188,7 @@ public class FEdge extends Edge { return this.newObjInfos.get(cd); } - public void addNewObjInfo(ClassDescriptor cd, int newRate, int probability) { + public void addNewObjInfo(ClassDescriptor cd, int newRate, double probability) { if(this.newObjInfos == null) { this.newObjInfos = new Hashtable(); } diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java index 4ed6f7d1..be82555b 100644 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java +++ b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java @@ -247,6 +247,7 @@ public class TaskAnalysis { //seen this node already fs_taskexit=canonicalizeFlagState(sourcenodes,fs_taskexit); FEdge newedge=new FEdge(fs_taskexit,taskname, td, parameterindex); + newedge.setTaskExitIndex(ffan.getTaskExitIndex()); ((Vector)tdToFEdges.get(td)).add(newedge); fs.addEdge(newedge); diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index 318f3c0d..74ab8a8e 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -442,6 +442,8 @@ public class BuildCode { outclassdefs.println(" int isolate;"); // indicate if this object is shared or not outclassdefs.println(" int version;"); outclassdefs.println(" struct ___Object___ * original;"); + outclassdefs.println(" int numlocks;"); // array for locks + outclassdefs.println(" int * locks;"); } if(state.OPTIONAL) { outclassdefs.println(" int numfses;"); @@ -1042,6 +1044,8 @@ public class BuildCode { classdefout.println(" int isolate;"); // indicate if this object is shared or not classdefout.println(" int version;"); classdefout.println(" struct ___Object___ * original;"); + classdefout.println(" int numlocks;"); // array for locks + classdefout.println(" int * locks;"); } if (state.OPTIONAL) { classdefout.println(" int numfses;"); @@ -2131,7 +2135,7 @@ public class BuildCode { output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";"); } - private void generateFlatNew(FlatMethod fm, LocalityBinding lb, FlatNew fn, PrintWriter output) { + protected void generateFlatNew(FlatMethod fm, LocalityBinding lb, FlatNew fn, PrintWriter output) { if (state.DSM && locality.getAtomic(lb).get(fn).intValue()>0&&!fn.isGlobal()) { //Stash pointer in case of GC String revertptr=generateTemp(fm, reverttable.get(lb),lb); diff --git a/Robust/src/IR/Flat/BuildCodeMultiCore.java b/Robust/src/IR/Flat/BuildCodeMultiCore.java index f247749e..11699e3b 100644 --- a/Robust/src/IR/Flat/BuildCodeMultiCore.java +++ b/Robust/src/IR/Flat/BuildCodeMultiCore.java @@ -911,6 +911,12 @@ public class BuildCodeMultiCore extends BuildCode { ", " + qinfo.length + ");"); output.println("}"); } + if(ffan.getTaskType()==FlatFlagActionNode.TASKEXIT) { + // generate codes for profiling, recording which task exit it is + output.println("#ifdef RAWPROFILE"); + output.println("setTaskExitIndex(" + ffan.getTaskExitIndex() + ");"); + output.println("#endif"); + } } } @@ -1267,12 +1273,15 @@ public class BuildCodeMultiCore extends BuildCode { protected void outputTransCode(PrintWriter output) { output.println("while(0 == isEmpty(totransobjqueue)) {"); - output.println(" struct QueueItem * totransitem = getTail(totransobjqueue);"); - - output.println(" transferObject((struct transObjInfo *)(totransitem->objectptr));"); - output.println(" RUNFREE(((struct transObjInfo *)(totransitem->objectptr))->queues);"); - output.println(" RUNFREE(totransitem->objectptr);"); - output.println(" removeItem(totransobjqueue, totransitem);"); + //output.println(" struct QueueItem * totransitem = getTail(totransobjqueue);"); + //output.println(" transferObject((struct transObjInfo *)(totransitem->objectptr));"); + //output.println(" RUNFREE(((struct transObjInfo *)(totransitem->objectptr))->queues);"); + //output.println(" RUNFREE(totransitem->objectptr);"); + //output.println(" removeItem(totransobjqueue, totransitem);"); + output.println(" struct transObjInfo * totransobj = (struct transObjInfo *)(getItem(totransobjqueue));"); + output.println(" transferObject(totransobj);"); + output.println(" RUNFREE(totransobj->queues);"); + output.println(" RUNFREE(totransobj);"); output.println("}"); output.println("freeQueue(totransobjqueue);"); } @@ -1601,6 +1610,12 @@ public class BuildCodeMultiCore extends BuildCode { output.println("addAliasLock(" + super.generateTemp(fm, fn.getDst(), lb) + ", aliaslocks[" + tmpv.elementAt(i).intValue() + "]);"); } } + // generate codes for profiling, recording how many new objects are created + if((fn.getType().getClassDesc() != null) && (fn.getType().getClassDesc().hasFlags())) { + output.println("#ifdef RAWPROFILE"); + output.println("addNewObjInfo(\"" + fn.getType().getClassDesc().getSymbol() + "\");"); + output.println("#endif"); + } } class TranObjInfo { diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java index 66b37355..9562bd27 100644 --- a/Robust/src/IR/Flat/BuildFlat.java +++ b/Robust/src/IR/Flat/BuildFlat.java @@ -939,6 +939,7 @@ public class BuildFlat { private NodePair flattenTaskExitNode(TaskExitNode ten) { FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.TASKEXIT); + ffan.setTaskExitIndex(ten.getTaskExitIndex()); updateFlagActionNode(ffan, ten.getFlagEffects()); NodePair fcn=flattenConstraintCheck(ten.getChecks()); ffan.addNext(fcn.getBegin()); diff --git a/Robust/src/IR/Flat/FlatFlagActionNode.java b/Robust/src/IR/Flat/FlatFlagActionNode.java index 2e176aad..8e018adc 100644 --- a/Robust/src/IR/Flat/FlatFlagActionNode.java +++ b/Robust/src/IR/Flat/FlatFlagActionNode.java @@ -21,6 +21,7 @@ public class FlatFlagActionNode extends FlatNode { Hashtable> cd2fs4new; Hashtable> fs2fs; + int m_taskexitindex; public FlatFlagActionNode(int taskexit) { tempflagpairs=new Hashtable(); @@ -30,6 +31,15 @@ public class FlatFlagActionNode extends FlatNode { this.cd2initfs = null; this.cd2fs4new = null; this.fs2fs = null; + this.m_taskexitindex = 0; + } + + public int getTaskExitIndex() { + return m_taskexitindex; + } + + public void setTaskExitIndex(int taskexitindex) { + this.m_taskexitindex = taskexitindex; } public int getTaskType() { diff --git a/Robust/src/IR/Tree/BuildIR.java b/Robust/src/IR/Tree/BuildIR.java index 13acd63b..b692207f 100644 --- a/Robust/src/IR/Tree/BuildIR.java +++ b/Robust/src/IR/Tree/BuildIR.java @@ -5,9 +5,14 @@ import java.util.*; public class BuildIR { State state; + + private int m_taskexitnum; + public BuildIR(State state) { this.state=state; + this.m_taskexitnum = 0; } + public void buildtree() { for(Iterator it=state.parsetrees.iterator(); it.hasNext();) { ParseNode pn=(ParseNode)it.next(); @@ -560,6 +565,7 @@ public class BuildIR { } public BlockNode parseBlock(ParseNode pn) { + this.m_taskexitnum = 0; if (pn==null||isEmpty(pn.getTerminal())) return new BlockNode(); ParseNode bsn=pn.getChild("block_statement_list"); @@ -636,7 +642,7 @@ public class BuildIR { if (pn.getChild("cons_checks")!=null) ccs=parseChecks(pn.getChild("cons_checks")); - blockstatements.add(new TaskExitNode(vfe, ccs)); + blockstatements.add(new TaskExitNode(vfe, ccs, this.m_taskexitnum++)); } else if (isNode(pn,"atomic")) { BlockNode bn=parseBlockHelper(pn); blockstatements.add(new AtomicNode(bn)); diff --git a/Robust/src/IR/Tree/TaskExitNode.java b/Robust/src/IR/Tree/TaskExitNode.java index 084b63bb..dbcb19ad 100644 --- a/Robust/src/IR/Tree/TaskExitNode.java +++ b/Robust/src/IR/Tree/TaskExitNode.java @@ -4,9 +4,12 @@ import java.util.Vector; public class TaskExitNode extends BlockStatementNode { Vector vfe; Vector ccs; - public TaskExitNode(Vector vfe, Vector ccs) { + int m_taskexitindex; + + public TaskExitNode(Vector vfe, Vector ccs, int taskexitindex) { this.vfe=vfe; this.ccs=ccs; + this.m_taskexitindex = taskexitindex; } public String printNode(int indent) { @@ -24,4 +27,8 @@ public class TaskExitNode extends BlockStatementNode { public int kind() { return Kind.TaskExitNode; } + + public int getTaskExitIndex() { + return m_taskexitindex; + } } diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index e9b82b96..01ed2f6b 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -6,6 +6,7 @@ import java.io.Reader; import java.io.BufferedReader; import java.io.FileReader; import java.io.FileInputStream; +import java.util.Hashtable; import java.util.Iterator; import java.util.Set; import java.util.Vector; @@ -278,6 +279,7 @@ public class Main { } } } + fss = null; } } @@ -292,8 +294,10 @@ public class Main { System.exit(-1); } String profiledata = new String(b, 0, length); - java.util.Hashtable taskinfo = new java.util.Hashtable(); + java.util.Hashtable taskinfos = new java.util.Hashtable(); + // profile data format: + // taskname, numoftaskexits(; exetime, probability, numofnewobjtypes(, newobj type, num of objs)+)+ int inindex = profiledata.indexOf('\n'); while((inindex != -1) ) { String inline = profiledata.substring(0, inindex); @@ -308,8 +312,76 @@ public class Main { while(inint.startsWith(" ")) { inint = inint.substring(1); } - int duration = Integer.parseInt(inint); - taskinfo.put(inname, duration); + tmpinindex = inint.indexOf(';'); + int numofexits = Integer.parseInt(inint.substring(0, tmpinindex)); + TaskInfo tinfo = new TaskInfo(numofexits); + inint = inint.substring(tmpinindex + 1); + while(inint.startsWith(" ")) { + inint = inint.substring(1); + } + for(int i = 0; i < numofexits; i++) { + String tmpinfo = null; + if(i < numofexits - 1) { + tmpinindex = inint.indexOf(';'); + tmpinfo = inint.substring(0, tmpinindex); + inint = inint.substring(tmpinindex + 1); + while(inint.startsWith(" ")) { + inint = inint.substring(1); + } + } else { + tmpinfo = inint; + } + + tmpinindex = tmpinfo.indexOf(','); + tinfo.m_exetime[i] = Integer.parseInt(tmpinfo.substring(0, tmpinindex)); + tmpinfo = tmpinfo.substring(tmpinindex + 1); + while(tmpinfo.startsWith(" ")) { + tmpinfo = tmpinfo.substring(1); + } + tmpinindex = tmpinfo.indexOf(','); + tinfo.m_probability[i] = Double.parseDouble(tmpinfo.substring(0, tmpinindex)); + tmpinfo = tmpinfo.substring(tmpinindex + 1); + while(tmpinfo.startsWith(" ")) { + tmpinfo = tmpinfo.substring(1); + } + tmpinindex = tmpinfo.indexOf(','); + int numofnobjs = 0; + if(tmpinindex == -1) { + numofnobjs = Integer.parseInt(tmpinfo); + if(numofnobjs != 0) { + System.err.println("Error profile data format!"); + System.exit(-1); + } + } else { + tinfo.m_newobjinfo.setElementAt(new Hashtable(), i); + numofnobjs = Integer.parseInt(tmpinfo.substring(0, tmpinindex)); + tmpinfo = tmpinfo.substring(tmpinindex + 1); + while(tmpinfo.startsWith(" ")) { + tmpinfo = tmpinfo.substring(1); + } + for(int j = 0; j < numofnobjs; j++) { + tmpinindex = tmpinfo.indexOf(','); + String nobjtype = tmpinfo.substring(0, tmpinindex); + tmpinfo = tmpinfo.substring(tmpinindex + 1); + while(tmpinfo.startsWith(" ")) { + tmpinfo = tmpinfo.substring(1); + } + int objnum = 0; + if(j < numofnobjs - 1) { + tmpinindex = tmpinfo.indexOf(','); + objnum = Integer.parseInt(tmpinfo.substring(0, tmpinindex)); + tmpinfo = tmpinfo.substring(tmpinindex + 1); + while(tmpinfo.startsWith(" ")) { + tmpinfo = tmpinfo.substring(1); + } + } else { + objnum = Integer.parseInt(tmpinfo); + } + tinfo.m_newobjinfo.elementAt(i).put(nobjtype, objnum); + } + } + } + taskinfos.put(inname, tinfo); inindex = profiledata.indexOf('\n'); } @@ -331,40 +403,18 @@ public class Main { int total = 100; for(int j = 0; j < numEdges; j++) { FEdge pfe = fev.elementAt(j); - if(numEdges - j == 1) { - pfe.setProbability(total); - } else { - if((total != 0) && (total != 1)) { - do { - tint = r.nextInt()%total; - } while(tint <= 0); - } - pfe.setProbability(tint); - total -= tint; + tint = taskinfos.get(td.getSymbol()).m_exetime[pfe.getTaskExitIndex()]; + pfe.setExeTime(tint); + double idouble = taskinfos.get(td.getSymbol()).m_probability[pfe.getTaskExitIndex()]; + pfe.setProbability(idouble); + int newRate = 0; + if((taskinfos.get(td.getSymbol()).m_newobjinfo.elementAt(pfe.getTaskExitIndex()) != null) + && (taskinfos.get(td.getSymbol()).m_newobjinfo.elementAt(pfe.getTaskExitIndex()).containsKey(cd.getSymbol()))) { + newRate = taskinfos.get(td.getSymbol()).m_newobjinfo.elementAt(pfe.getTaskExitIndex()).get(cd.getSymbol()); } - //do { - // tint = r.nextInt()%10; - // } while(tint <= 0); - //int newRate = tint; - //int newRate = (j+1)%2+1; - int newRate = 1; - String cdname = cd.getSymbol(); - if((cdname.equals("SeriesRunner")) || - (cdname.equals("MDRunner")) || - (cdname.equals("Stage")) || - (cdname.equals("AppDemoRunner")) || - (cdname.equals("FilterBankAtom"))) { - newRate = 16; - } else if(cdname.equals("SentenceParser")) { - newRate = 4; - } - //do { - // tint = r.nextInt()%100; - // } while(tint <= 0); - // int probability = tint; - int probability = 100; - pfe.addNewObjInfo(cd, newRate, probability); + pfe.addNewObjInfo(cd, newRate, idouble); } + fev = null; } } } @@ -375,39 +425,16 @@ public class Main { Iterator it_edges = fs.edges(); int total = 100; while(it_edges.hasNext()) { - //do { - // tint = r.nextInt()%10; - // } while(tint <= 0); FEdge edge = (FEdge)it_edges.next(); - tint = taskinfo.get(edge.getTask().getSymbol()).intValue(); + tint = taskinfos.get(edge.getTask().getSymbol()).m_exetime[edge.getTaskExitIndex()]; edge.setExeTime(tint); - if((fs.getClassDescriptor().getSymbol().equals("MD")) && (edge.getTask().getSymbol().equals("t6"))) { - if(edge.isbackedge()) { - if(edge.getTarget().equals(edge.getSource())) { - edge.setProbability(93.75); - } else { - edge.setProbability(3.125); - } - } else { - edge.setProbability(3.125); - } - continue; - } - if(!it_edges.hasNext()) { - edge.setProbability(total); - } else { - if((total != 0) && (total != 1)) { - do { - tint = r.nextInt()%total; - } while(tint <= 0); - } - edge.setProbability(tint); - total -= tint; - } + double idouble = taskinfos.get(edge.getTask().getSymbol()).m_probability[edge.getTaskExitIndex()]; + edge.setProbability(idouble); } } } } + taskinfos = null; } else { // for test // Randomly set the newRate and probability of FEdges @@ -463,6 +490,7 @@ public class Main { int probability = 100; pfe.addNewObjInfo(cd, newRate, probability); } + fev = null; } } } @@ -577,6 +605,7 @@ public class Main { } else if(tmpTime == processTime) { selectedScheduling.add(index); } + scheduling = null; index++; } System.out.print("Selected schedulings with least exectution time " + processTime + ": \n\t"); @@ -633,7 +662,9 @@ public class Main { BuildCodeMultiCore bcm=new BuildCodeMultiCore(state, bf.getMap(), tu, sa, scheduling, scheduleAnalysis.getCoreNum(), pa); bcm.setOwnershipAnalysis(oa); bcm.buildCode(); + scheduling = null; } + selectedScheduling = null; } } @@ -699,4 +730,21 @@ public class Main { System.exit(l.numErrors()); } } + + static class TaskInfo { + public int m_numofexits; + public int[] m_exetime; + public double[] m_probability; + public Vector> m_newobjinfo; + + public TaskInfo(int numofexits) { + this.m_numofexits = numofexits; + this.m_exetime = new int[this.m_numofexits]; + this.m_probability = new double[this.m_numofexits]; + this.m_newobjinfo = new Vector>(); + for(int i = 0; i < this.m_numofexits; i++) { + this.m_newobjinfo.add(null); + } + } + } } diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c index 94626696..37bb8f82 100644 --- a/Robust/src/Runtime/multicoretask.c +++ b/Robust/src/Runtime/multicoretask.c @@ -128,6 +128,8 @@ typedef struct task_info { char* taskName; int startTime; int endTime; + int exitIndex; + struct Queue * newObjs; } TaskInfo; /*typedef struct interrupt_info { @@ -435,6 +437,8 @@ void run(void* arg) { taskInfo->taskName = "objqueue checking"; taskInfo->startTime = raw_get_cycle(); taskInfo->endTime = -1; + taskInfo->exitIndex = -1; + taskInfo->newObjs = NULL; } isChecking = true; } @@ -1898,15 +1902,42 @@ void outputProfileData() { if((fp = fopen(fn, "w+")) == NULL) { fprintf(stderr, "fopen error\n"); - return -1; + return; } - fprintf(fp, "Task Name, Start Time, End Time, Duration\n"); + fprintf(fp, "Task Name, Start Time, End Time, Duration, Exit Index(, NewObj Name, Num)+\n"); // output task related info for(i = 0; i < taskInfoIndex; i++) { TaskInfo* tmpTInfo = taskInfoArray[i]; int duration = tmpTInfo->endTime - tmpTInfo->startTime; - fprintf(fp, "%s, %d, %d, %d\n", tmpTInfo->taskName, tmpTInfo->startTime, tmpTInfo->endTime, duration); + fprintf(fp, "%s, %d, %d, %d, %d", tmpTInfo->taskName, tmpTInfo->startTime, tmpTInfo->endTime, duration, tmpTInfo->exitIndex); + // summarize new obj info + if(tmpTInfo->newObjs != NULL) { + struct RuntimeHash * nobjtbl = allocateRuntimeHash(5); + struct RuntimeIterator * iter = NULL; + while(0 == isEmpty(tmpTInfo->newObjs)) { + char * objtype = (char *)(getItem(tmpTInfo->newObjs)); + if(RuntimeHashcontainskey(nobjtbl, (int)(objtype))) { + int num = 0; + RuntimeHashget(nobjtbl, (int)objtype, &num); + RuntimeHashremovekey(nobjtbl, (int)objtype); + num++; + RuntimeHashadd(nobjtbl, (int)objtype, num); + } else { + RuntimeHashadd(nobjtbl, (int)objtype, 1); + } + //fprintf(stderr, "new obj!\n"); + } + + // output all new obj info + iter = RuntimeHashcreateiterator(nobjtbl); + while(RunhasNext(iter)) { + char * objtype = (char *)Runkey(iter); + int num = Runnext(iter); + fprintf(fp, ", %s, %d", objtype, num); + } + } + fprintf(fp, "\n"); if(strcmp(tmpTInfo->taskName, "tpd checking") == 0) { preprocessingtime += duration; } else if(strcmp(tmpTInfo->taskName, "post task execution") == 0) { @@ -1954,6 +1985,37 @@ void outputProfileData() { raw_test_pass(0xdddb); raw_test_pass_reg(tmpTInfo->startTime); raw_test_pass_reg(tmpTInfo->endTime); + raw_test_pass_reg(tmpTInfo->exitIndex); + if(tmpTInfo->newObjs != NULL) { + struct RuntimeHash * nobjtbl = allocateRuntimeHash(5); + struct RuntimeIterator * iter = NULL; + while(0 == isEmpty(tmpTInfo->newObjs)) { + char * objtype = (char *)(getItem(tmpTInfo->newObjs)); + if(RuntimeHashcontainskey(nobjtbl, (int)(objtype))) { + int num = 0; + RuntimeHashget(nobjtbl, (int)objtype, &num); + RuntimeHashremovekey(nobjtbl, (int)objtype); + num++; + RuntimeHashadd(nobjtbl, (int)objtype, num); + } else { + RuntimeHashadd(nobjtbl, (int)objtype, 1); + } + } + + // ouput all new obj info + iter = RuntimeHashcreateiterator(nobjtbl); + while(RunhasNext(iter)) { + char * objtype = (char *)Runkey(iter); + int num = Runnext(iter); + int nameLen = strlen(objtype); + raw_test_pass(0xddda); + for(j = 0; j < nameLen; j++) { + raw_test_pass_reg(objtype[j]); + } + raw_test_pass(0xdddb); + raw_test_pass_reg(num); + } + } raw_test_pass(0xdddc); } @@ -1977,6 +2039,17 @@ void outputProfileData() { raw_test_pass(0xeeee); #endif } + +inline void setTaskExitIndex(int index) { + taskInfoArray[taskInfoIndex]->exitIndex = index; +} + +inline void addNewObjInfo(void * nobj) { + if(taskInfoArray[taskInfoIndex]->newObjs == NULL) { + taskInfoArray[taskInfoIndex]->newObjs = createQueue(); + } + addNewItem(taskInfoArray[taskInfoIndex]->newObjs, nobj); +} #endif // receive object transferred from other cores @@ -3548,6 +3621,8 @@ newtask: checkTaskInfo->taskName = "tpd checking"; checkTaskInfo->startTime = raw_get_cycle(); checkTaskInfo->endTime = -1; + checkTaskInfo->exitIndex = -1; + checkTaskInfo->newObjs = NULL; } #endif currtpd=(struct taskparamdescriptor *) getfirstkey(activetasks); @@ -3945,6 +4020,8 @@ execute: taskInfo->taskName = currtpd->task->name; taskInfo->startTime = raw_get_cycle(); taskInfo->endTime = -1; + taskInfo->exitIndex = -1; + taskInfo->newObjs = NULL; } #endif @@ -3975,6 +4052,8 @@ execute: postTaskInfo->taskName = "post task execution"; postTaskInfo->startTime = raw_get_cycle(); postTaskInfo->endTime = -1; + postTaskInfo->exitIndex = -1; + postTaskInfo->newObjs = NULL; } #endif #ifdef RAWDEBUG diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h index 0a5374bd..27e83f2d 100644 --- a/Robust/src/Runtime/runtime.h +++ b/Robust/src/Runtime/runtime.h @@ -114,6 +114,10 @@ void flagorandinit(void * ptr, int ormask, int andmask); void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length); #ifdef RAW void enqueueObject_I(void * ptr, struct parameterwrapper ** queues, int length); +#ifdef RAWPROFILE +inline void setTaskExitIndex(int index); +inline void addNewObjInfo(void * nobj); +#endif #endif void addAliasLock(void * ptr, int lock); #else diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 5f2a4a8b..9744afdc 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -249,7 +249,7 @@ fi if $MULTICOREFLAG then -if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ +if ! java -Xms50m -Xmx600m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ $ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \ $JAVAOPTS $SRCFILES then exit $?