add source code that does not have location annotations.
[IRC.git] / Robust / CoreProf / Trace.java
index d85b15a25cf3472cc3ba556d8c9f9e43ddaa3a7f..0d4cf9882de653377706b29b410fdea7bc8fba63 100644 (file)
@@ -19,12 +19,14 @@ public class Trace {
   public static final int CP_EVENTID_COUNT_POOLALLOC  = 0x15;
   public static final int CP_EVENTID_COUNT_POOLREUSE  = 0x16;
   public static final int CP_EVENTID_WORKSCHEDGRAB    = 0x20;
+  public static final int CP_EVENTID_WORKSCHEDSUBMIT  = 0x21;
   public static final int CP_EVENTID_TASKDISPATCH     = 0x30;
   public static final int CP_EVENTID_PREPAREMEMQ      = 0x31;
   public static final int CP_EVENTID_TASKEXECUTE      = 0x40;
   public static final int CP_EVENTID_TASKRETIRE       = 0x50;
   public static final int CP_EVENTID_TASKSTALLVAR     = 0x60;
   public static final int CP_EVENTID_TASKSTALLMEM     = 0x61;
+  public static final int CP_EVENTID_RCR_TRAVERSE     = 0x80;
   public static final int CP_EVENTID_DEBUG_A          = 0x180;
   public static final int CP_EVENTID_DEBUG_B          = 0x181;
   public static final int CP_EVENTID_DEBUG_C          = 0x182;
@@ -39,29 +41,31 @@ public class Trace {
 
   void initNames() {
     eid2name = new Hashtable<Integer, String>();
-    eid2name.put( CP_EVENTID_MAIN,              "MAIN         " );
-    eid2name.put( CP_EVENTID_RUNMALLOC,         "RUNMALLOC    " );
-    eid2name.put( CP_EVENTID_RUNFREE,           "RUNFREE      " );
-    eid2name.put( CP_EVENTID_POOLALLOC,         "POOLALLOC    " );
-    eid2name.put( CP_EVENTID_COUNT_POOLALLOC,   "POOLALLOC CNT" );
-    eid2name.put( CP_EVENTID_COUNT_POOLREUSE,   "POOLREUSE CNT" );
-    eid2name.put( CP_EVENTID_WORKSCHEDGRAB,     "WORKSCHEDGRAB" );
-    eid2name.put( CP_EVENTID_TASKDISPATCH,      "TASKDISPATCH " );
-    eid2name.put( CP_EVENTID_PREPAREMEMQ,       "PREPAREMEMQ  " );
-    eid2name.put( CP_EVENTID_TASKEXECUTE,       "TASKEXECUTE  " );
-    eid2name.put( CP_EVENTID_TASKRETIRE,        "TASKRETIRE   " );
-    eid2name.put( CP_EVENTID_TASKSTALLVAR,      "TASKSTALLVAR " );
-    eid2name.put( CP_EVENTID_TASKSTALLMEM,      "TASKSTALLMEM " );
-    eid2name.put( CP_EVENTID_DEBUG_A,           "DEBUG A      " );
-    eid2name.put( CP_EVENTID_DEBUG_B,           "DEBUG B      " );
-    eid2name.put( CP_EVENTID_DEBUG_C,           "DEBUG C      " );
-    eid2name.put( CP_EVENTID_DEBUG_D,           "DEBUG D      " );
-    eid2name.put( CP_EVENTID_DEBUG_E,           "DEBUG E      " );
-    eid2name.put( CP_EVENTID_DEBUG_F,           "DEBUG F      " );
-    eid2name.put( CP_EVENTID_DEBUG_G,           "DEBUG G      " );
-    eid2name.put( CP_EVENTID_DEBUG_H,           "DEBUG H      " );
-    eid2name.put( CP_EVENTID_DEBUG_I,           "DEBUG I      " );
-    eid2name.put( CP_EVENTID_DEBUG_J,           "DEBUG J      " );
+    eid2name.put( CP_EVENTID_MAIN,              "MAIN           " );
+    eid2name.put( CP_EVENTID_RUNMALLOC,         "RUNMALLOC      " );
+    eid2name.put( CP_EVENTID_RUNFREE,           "RUNFREE        " );
+    eid2name.put( CP_EVENTID_POOLALLOC,         "POOLALLOC      " );
+    eid2name.put( CP_EVENTID_COUNT_POOLALLOC,   "POOLALLOC CNT  " );
+    eid2name.put( CP_EVENTID_COUNT_POOLREUSE,   "POOLREUSE CNT  " );
+    eid2name.put( CP_EVENTID_WORKSCHEDGRAB,     "WORKSCHEDGRAB  " );
+    eid2name.put( CP_EVENTID_WORKSCHEDSUBMIT,   "WORKSCHEDSUBMIT" );
+    eid2name.put( CP_EVENTID_TASKDISPATCH,      "TASKDISPATCH   " );
+    eid2name.put( CP_EVENTID_PREPAREMEMQ,       "PREPAREMEMQ    " );
+    eid2name.put( CP_EVENTID_TASKEXECUTE,       "TASKEXECUTE    " );
+    eid2name.put( CP_EVENTID_TASKRETIRE,        "TASKRETIRE     " );
+    eid2name.put( CP_EVENTID_TASKSTALLVAR,      "TASKSTALLVAR   " );
+    eid2name.put( CP_EVENTID_TASKSTALLMEM,      "TASKSTALLMEM   " );
+    eid2name.put( CP_EVENTID_RCR_TRAVERSE,      "RCR TRAVERSE   " );
+    eid2name.put( CP_EVENTID_DEBUG_A,           "DEBUG A        " );
+    eid2name.put( CP_EVENTID_DEBUG_B,           "DEBUG B        " );
+    eid2name.put( CP_EVENTID_DEBUG_C,           "DEBUG C        " );
+    eid2name.put( CP_EVENTID_DEBUG_D,           "DEBUG D        " );
+    eid2name.put( CP_EVENTID_DEBUG_E,           "DEBUG E        " );
+    eid2name.put( CP_EVENTID_DEBUG_F,           "DEBUG F        " );
+    eid2name.put( CP_EVENTID_DEBUG_G,           "DEBUG G        " );
+    eid2name.put( CP_EVENTID_DEBUG_H,           "DEBUG H        " );
+    eid2name.put( CP_EVENTID_DEBUG_I,           "DEBUG I        " );
+    eid2name.put( CP_EVENTID_DEBUG_J,           "DEBUG J        " );
   }
 
   Hashtable<Integer, String> eid2name;
@@ -134,6 +138,10 @@ public class Trace {
   long mintime;
   long scale;
 
+  long minObservedTime = Long.MAX_VALUE;
+  long maxObservedTime = Long.MIN_VALUE;
+
+
   public Trace( boolean c2txt, String inFile, String outFile,  HashSet<Integer> eventset, long mintime, long maxtime, long scale) {
     this.eventset=eventset;
     this.maxtime=maxtime;
@@ -146,6 +154,12 @@ public class Trace {
 
     initNames();
 
+    if( convert2txt ) {
+      try { 
+        txtStream = new BufferedWriter( new FileWriter( "events.txt" ) ); 
+      } catch( Exception e ) { e.printStackTrace(); System.exit( -1 ); }
+    }
+
     if (convert2plot) {
       printPlotCmd();
     }
@@ -154,8 +168,20 @@ public class Trace {
       readThread( i );
     }
 
+    System.out.println( "Minimum observed time stamp: "+minObservedTime );
+    System.out.println( "Maximum observed time stamp: "+maxObservedTime );
+    
+    System.out.println( "\nelapsed time: "+(maxObservedTime - minObservedTime) );
+
+
     printStats( outFile );
 
+    if( convert2txt ) {
+      try {
+        txtStream.close();
+      } catch( Exception e ) { e.printStackTrace(); System.exit( -1 ); }
+    }
+
     if( convert2plot ) {
       try {
        bwPlot.write("plot [0:"+(globendtime/scale)+"] [-1:"+(numThreads+1)+"] -3\n");
@@ -289,8 +315,6 @@ public class Trace {
 
     if( convert2txt ) {
       try {
-        txtStream = new BufferedWriter( new FileWriter( "events.txt" ) );
-
         txtStream.write( "\n\n\n\n" );
         txtStream.write( "*************************************************\n" );
         txtStream.write( "**  Thread "+tNum+"\n" );
@@ -331,6 +355,16 @@ public class Trace {
       timeStamp    = readLong( tdata.dataStream );
       i += 3;
 
+      
+      if( timeStamp < minObservedTime ) {
+        minObservedTime = timeStamp;
+      }
+
+      if( timeStamp > maxObservedTime ) {
+        maxObservedTime = timeStamp;
+      }
+
+
       int eventType = eventRaw &  CP_EVENT_MASK;
       int eventID   = eventRaw >> CP_EVENT_BASESHIFT;
 
@@ -522,7 +556,8 @@ public class Trace {
          globendtime=nend;
        if (nstart<0)
          nstart=0;
-       bwPlot.write( "set arrow from "+(nstart/scale)+","+thread+" to "+(nend/scale)+","+thread+" lt "+eventID+" nohead\n");
+       bwPlot.write( "set arrow from "+(nstart/scale)+","+thread+
+                      " to "+(nend/scale)+","+thread+" lt "+eventID+"\n");
       }
     } catch( IOException e ) {
       e.printStackTrace();