From 3ed159976d22ddaf99cec81365e7f913b97c4bbc Mon Sep 17 00:00:00 2001 From: bdemsky Date: Mon, 2 Aug 2010 23:09:17 +0000 Subject: [PATCH] checking outstanding changes in my CVS starting coreprof extension --- .../Benchmarks/SingleTM/Bayes/Learner.java | 1 + Robust/src/Benchmarks/SingleTM/compileall | 18 ++--- Robust/src/IR/State.java | 1 + Robust/src/Main/Main.java | 3 + Robust/src/Makefile | 4 +- Robust/src/Runtime/coreprof/coreprof.c | 75 +++++++++++++++++++ Robust/src/Runtime/coreprof/coreprof.h | 34 +++++++++ Robust/src/buildscript | 22 +++++- 8 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 Robust/src/Runtime/coreprof/coreprof.c create mode 100644 Robust/src/Runtime/coreprof/coreprof.h diff --git a/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java b/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java index e3fd9e6f..f10a5f5c 100644 --- a/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java +++ b/Robust/src/Benchmarks/SingleTM/Bayes/Learner.java @@ -207,6 +207,7 @@ public class Learner { lss.i_stop = stop; } + /* ============================================================================= * createTaskList * -- baseLogLikelihoods and taskListPtr are updated diff --git a/Robust/src/Benchmarks/SingleTM/compileall b/Robust/src/Benchmarks/SingleTM/compileall index 58602031..3c010543 100755 --- a/Robust/src/Benchmarks/SingleTM/compileall +++ b/Robust/src/Benchmarks/SingleTM/compileall @@ -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 diff --git a/Robust/src/IR/State.java b/Robust/src/IR/State.java index 2dde8276..2a8a473e 100644 --- a/Robust/src/IR/State.java +++ b/Robust/src/IR/State.java @@ -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; diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 047f6de7..aefe03a3 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -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; diff --git a/Robust/src/Makefile b/Robust/src/Makefile index fda0ec2f..2ec3843b 100644 --- a/Robust/src/Makefile +++ b/Robust/src/Makefile @@ -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 index 00000000..6014572b --- /dev/null +++ b/Robust/src/Runtime/coreprof/coreprof.c @@ -0,0 +1,75 @@ +#include "runtime.h" +#include "coreprof.h" +#include +#include +#include +#include +#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<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 index 00000000..1ba499ac --- /dev/null +++ b/Robust/src/Runtime/coreprof/coreprof.h @@ -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 diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 3c3d90a4..b445cc68 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -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 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" -- 2.34.1