checking outstanding changes in my CVS
authorbdemsky <bdemsky>
Mon, 2 Aug 2010 23:09:17 +0000 (23:09 +0000)
committerbdemsky <bdemsky>
Mon, 2 Aug 2010 23:09:17 +0000 (23:09 +0000)
starting coreprof extension

Robust/src/Benchmarks/SingleTM/Bayes/Learner.java
Robust/src/Benchmarks/SingleTM/compileall
Robust/src/IR/State.java
Robust/src/Main/Main.java
Robust/src/Makefile
Robust/src/Runtime/coreprof/coreprof.c [new file with mode: 0644]
Robust/src/Runtime/coreprof/coreprof.h [new file with mode: 0644]
Robust/src/buildscript

index e3fd9e6f3c2a993e8fbd3c044fef0b66152c35e0..f10a5f5c369a77ce75b406730a60ff8a2fbec809 100644 (file)
@@ -207,6 +207,7 @@ public class Learner {
       lss.i_stop = stop;
     }
 
+
   /* =============================================================================
    * createTaskList
    * -- baseLogLikelihoods and taskListPtr are updated
index 586020312fec8dc0b2bb5c2067023479f71376ae..3c0105436975f09955e5e9161a1adf4f78e29b98 100755 (executable)
@@ -1,36 +1,36 @@
 #!/bin/bash
 cd KMeans
-make &
+make
 cd ..
 
 cd SSCA2
-make &
+make
 cd ..
 
 cd Labyrinth3D
-make &
+make
 cd ..
 
 cd Genome
-make &
+make
 cd ..
 
 cd Intruder
-make &
+make
 cd ..
 
 cd Bayes
-make &
+make
 cd ..
 
 cd Vacation
-make &
+make
 cd ..
 
 cd Yada
-make &
+make
 cd ..
 
 cd LeeRouting
-make &
+make
 cd ..
\ No newline at end of file
index 2dde82764fd1a0da8e8b008ff490ecfaffeccab8..2a8a473e4b64784ac5a71a66bb4ba53b4a79ab22 100644 (file)
@@ -47,6 +47,7 @@ public class State {
 
   /** Boolean flag which indicates whether compiler is compiling a task-based
    * program. */
+  public boolean COREPROF=false;
   public boolean WEBINTERFACE=false;
   public boolean MINIMIZE=false;
   public boolean TASK=false;
index 047f6de77059dfb555975dd202fd1698cfd4cfa3..aefe03a34bad0cb9836ce87351c299d05360c9a4 100644 (file)
@@ -322,6 +322,9 @@ public class Main {
 
       } else if (option.equals("-methodeffects")) {
        state.METHODEFFECTS=true;
+       
+      } else if (option.equals("-coreprof")) {
+       state.COREPROF=true;
 
       } else if (option.equals("-ooojava")) {
        state.OOOJAVA  = true;
index fda0ec2fb1086c375f62d39adea76af3fbc857fa..2ec3843b24d2f1f32e7c508dd8a76a64e2ed4dc0 100644 (file)
@@ -160,10 +160,10 @@ classfiles:
        ./ourjavac -cp ../cup:.:$(CLASSPATH) Main/Main.java
 
 wc:
-       wc Interface/*.java Analysis/*/*.java IR/*.java IR/*/*.java Lex/*.java Util/*.java ClassLibrary/*.java
+       wc Interface/*.java Analysis/*/*.java IR/*.java IR/*/*.java Lex/*.java Util/*.java ClassLibrary/*.java Main/*.java
 
 wcrun:
-       wc Runtime/*.[c,h] Runtime/DSTM/interface/*.[c,h] Runtime/STM/*.[c,h]
+       wc Runtime/*.[c,h] Runtime/DSTM/interface*/*.[c,h] Runtime/STM/*.[c,h]
 
 Parse/Parser.java Parse/Sym.java: Parse/java14.cup
        cd Parse && \
diff --git a/Robust/src/Runtime/coreprof/coreprof.c b/Robust/src/Runtime/coreprof/coreprof.c
new file mode 100644 (file)
index 0000000..6014572
--- /dev/null
@@ -0,0 +1,75 @@
+#include "runtime.h"
+#include "coreprof.h"
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "mlp_lock.h"
+
+__thread struct coreprofmonitor * cp_events;
+struct coreprofmonitor * cp_eventlist=NULL;
+static volatile int cp_threadcount=0;
+__thread int threadnum;
+
+//Need to have global lock before calling this method
+void createprofiler() {
+  struct coreprofmonitor *event=calloc(1, sizeof(struct coreprofmonitor));
+  //add new eventmonitor to list
+  struct coreprofmonitor *tmp;
+
+  //add ourself to the list
+  do {
+    tmp=cp_eventlist;
+    event->next=tmp;
+  } while(CAS(&cp_eventlist, tmp, event)!=tmp);
+
+  int ourcount=atomic_inc(&cp_threadcount);
+  cp_threadnum=ourcount;
+
+  //point thread lock variable to eventmonitor
+  cp_events=event;
+  CPLOGEVENT((CP_START<<CP_BASE_SHIFT)|CP_BEGIN);
+}
+
+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 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, &version, sizeof(int));
+  while(ptr!=NULL) {
+    count++;
+    if (ptr->index>CPMAXEVENTS) {
+      printf("ERROR: EVENT COUNT EXCEEDED\n");
+    }
+    ptr=ptr->next;
+  }
+
+  //Write the number of threads
+  cpwritedata(fd, (char *)&count, sizeof(int));
+
+  //Write the number of events for each thread
+  ptr=cp_eventlist;
+  while(ptr!=NULL) {
+    cpwritedata(fd, &ptr->index, sizeof(int));
+    ptr=ptr->next;
+  }
+
+  //Dump the data
+  ptr=cp_eventlist;
+  while(ptr!=NULL) {
+    cpwritedata(fd, (char *) ptr->value, sizeof(int)*ptr->index);
+    ptr=ptr->next;
+  }  
+  close(fd);
+}
diff --git a/Robust/src/Runtime/coreprof/coreprof.h b/Robust/src/Runtime/coreprof/coreprof.h
new file mode 100644 (file)
index 0000000..1ba499a
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef COREPROF_H
+#define COREPROF_H
+
+#ifndef CPMAXEVENTS
+#define CPMAXEVENTS (1024*1024*128)
+#endif
+
+#define CP_BEGIN 0
+#define CP_END 1
+#define CP_EVENT 2
+#define CP_MASK 3
+#define CP_BASE_SHIFT 2
+
+#define CP_MAIN 0
+
+struct coreprofmonitor {
+  int index;
+  struct coreprofmonitor * next;
+  unsigned int value[MAXEVENTS];
+};
+
+extern __thread int cp_threadnum;
+extern __thread struct coreprofmonitor * cp_events;
+extern struct coreprofmonitor * cp_eventlist;
+void createprofiler();
+void dumpprofiler();
+
+#define CPLOGTIME *((long long *)&cp_events->value[cp_events->index])=rdtsc(); \
+  cp_events->index+=2;
+
+#define CPLOGEVENT(x) { CP_events->value[cp_events->index++]=x;        \
+    CPLOGTIME                                                  \
+      }
+#endif
index 3c3d90a4bcd3e6deaebd06c0c5a0f48edffd67a6..b445cc68a04b3a00b6e2a6feb1a852fe7cf34660 100755 (executable)
@@ -16,6 +16,12 @@ echo "-hybrid use fission only when it looks like a good choice"
 echo "-numa numa aware"
 echo "-eventmonitor turn on transaction event trace recording"
 echo
+echo OOOJava options
+echo -coreprof turn on profiling API
+echo -ooojava numberofcores maxseseage
+echo -mlp <num cores> <max sese age> build mlp code
+echo -mlpdebug if mlp, report progress and interim results
+echo
 echo DSM options
 echo -dsm distributed shared memory
 echo -abortreaders abort readers immediately
@@ -32,7 +38,6 @@ echo "-rawpath print out execute path information for raw version (should be use
 echo "-useprofile use profiling data for scheduling (should be used together with -raw)"
 echo -printscheduling print out scheduling graphs
 echo -printschedulesim print out scheduling simulator result graphs
-echo -abcclose close the array boundary check
 echo "-tilera_bme generate tilera version binary for Bare Mental Environment (should be used together with -multicore"
 echo "-tilera_zlinux generate tilera version binary for Zero-Overhead Linux with multi-process mode (should be used together with -multicore"
 echo "-tileraconfig config tilera simulator/pci as nxm (should be used together with -tilera)"
@@ -57,6 +62,7 @@ echo -accurateprofile build with accurate profile information including pre/post
 echo "-useio use standard io to output profiling data (should be used together with -raw and -profile), it only works with single core version"
 echo
 echo Other options
+echo -abcclose turnoff array boundary checks
 echo -builddir setup different build directory
 echo -robustroot set up the ROBUSTROOT to directory other than default one
 echo -readset turn on readset
@@ -103,6 +109,7 @@ echo -help help
 }
 
 tmpbuilddirectory="tmpbuilddirectory"
+COREPROF=false;
 NUMA=false;
 SANDBOX=false;
 ABORTREADERS=false;
@@ -480,6 +487,14 @@ EXTRAOPTIONS="$EXTRAOPTIONS -DPRECISE_GC -lpthread -DMLP"
 shift
 shift
 
+elif [[ $1 = '-coreprof' ]]
+then
+COREPROF=true
+JAVAOPTS="$JAVAOPTS -coreprof"
+EXTRAOPTIONS="$EXTRAOPTIONS -DCOREPROF"
+shift
+shift
+
 elif [[ $1 = '-mlp' ]]
 then
 MLP_ON=true
@@ -1026,6 +1041,11 @@ then
 FILES="$FILES $ROBUSTROOT/Runtime/localobjects.c"
 fi
 
+if $COREPROF
+then
+FILES="$FILES $ROBUSTROOT/Runtime/coreprof/coreprof.c"
+fi
+
 if $MLP_ON
 then
 FILES="$FILES $ROBUSTROOT/Runtime/mlp_runtime.c"