code for readable profiles
authorbdemsky <bdemsky>
Tue, 5 Jul 2011 23:06:07 +0000 (23:06 +0000)
committerbdemsky <bdemsky>
Tue, 5 Jul 2011 23:06:07 +0000 (23:06 +0000)
Robust/src/Runtime/bamboo/multicoregcprofile.c
Robust/src/Runtime/bamboo/multicoregcprofile.h
Robust/src/Runtime/bamboo/multicoreprofile.c [deleted file]
Robust/src/Runtime/bamboo/multicoreprofile.h [deleted file]
Robust/src/Runtime/bamboo/multicoreruntime.c

index 97b2b83caba498012e8e70db082bb361c33136b8..fa53cab6f1a2a3219f16b6e048de7ad1125683ac 100644 (file)
@@ -1,5 +1,4 @@
-#ifdef MULTICORE_GC
-#ifdef GC_PROFILE
+#if defined(MULTICORE_GC)&&defined(GC_PROFILE)
 #include "multicoregcprofile.h"
 #include "structdefs.h"
 #include "runtime_arch.h"
@@ -69,5 +68,25 @@ void gc_outputProfileData() {
   BAMBOO_PRINT(0xeeee);
 #endif
 }
-#endif  // GC_PROFILE
+
+// output the profiling data
+void gc_outputProfileDataReadable() {
+  // output task related info
+  for(int i= 0; i < gc_infoIndex; i++) {
+    GCInfo * gcInfo = gc_infoArray[i];
+
+    unsigned long long starttime=gcInfo->time[0]; //0;
+
+    for(int j = 1; j < gcInfo->index - 7; j++) {
+      printf("Event %u time since start=%llu, time since last event=%llu\n",j, gcInfo->time[j]-starttime, gcInfo->time[j]-gcInfo->time[j-1]);
+    }
+    printf("Livespace %llu\n", gcInfo->time[gcInfo->index-7]);
+    printf("Freespace %llu\n", gcInfo->time[gcInfo->index-6]);
+    printf("# Lobj %llu\n", gcInfo->time[gcInfo->index-5]);
+    printf("Lobj space %llu\n", gcInfo->time[gcInfo->index-4]);
+    printf("# obj %llu\n", gcInfo->time[gcInfo->index-3]);
+    printf("# live obj %llu\n", gcInfo->time[gcInfo->index-2]);
+    printf("# forward obj %llu\n", gcInfo->time[gcInfo->index-1]);
+  }
+}
 #endif // MULTICORE_GC
index 9b6c906e2a5493220e651019ee732f90ba0b3329..9e7a79e0e34b9f43e37a5c9c83fd626c67bd071e 100644 (file)
@@ -38,6 +38,7 @@ volatile bool gc_profile_flag;
 
 void initmulticoregcprofiledata(void);
 void gc_outputProfileData();
+void gc_outputProfileDataReadable();
 
 INLINE static void gc_profileInit() {
   gc_num_livespace = 0;
diff --git a/Robust/src/Runtime/bamboo/multicoreprofile.c b/Robust/src/Runtime/bamboo/multicoreprofile.c
deleted file mode 100644 (file)
index acde454..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#include "multicoreprofile.h"
-#include "runtime_arch.h"
-
-struct profiledata * eventdata;
-
-void startEvent(enum eventtypes event) {
-  struct eventprofile *profile=&eventdata->cores[BAMBOO_NUM_OF_CORE].events[event];
-  profile->totaltimestarts+=BAMBOO_GET_EXE_TIME();
-  profile->numstarts++;
-}
-
-void stopEvent(enum eventtypes event) {
-  struct eventprofile *profile=&eventdata->cores[BAMBOO_NUM_OF_CORE].events[event];
-  profile->totaltimestops+=BAMBOO_GET_EXE_TIME();
-  profile->numstops++;
-}
-
-void printResults() {
-  for(int core=0;core<NUMCORES;core++) {
-    printf("Core: %u", core);
-    for(int event=0;event<EV_NUMEVENTS;event++) {
-      printf("  Event:%s\n", eventnames[event]);
-      struct eventprofile *profile=&eventdata->cores[core].events[event];
-      if (profile->numstarts!=profile->numstops) {
-       printf("    Mismatched starts and stops\n");
-      }
-      long long totaltime=profile->totaltimestops-profile->totaltimestarts;
-      printf("    Total time: %llu Total events: %u Average time:%f\n", totaltime, profile->numstarts, ((double)totaltime)/profile->numstarts);
-    }
-  }
-}
diff --git a/Robust/src/Runtime/bamboo/multicoreprofile.h b/Robust/src/Runtime/bamboo/multicoreprofile.h
deleted file mode 100644 (file)
index 91522e0..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef MULTICOREPROFILE_H
-#define MULTICOREPROFILE_H
-#include "structdefs.h"
-
-enum eventtypes {
-  EV_GCTIME,
-  EV_NUMEVENTS
-};
-
-char eventnames[][30]={"gctime", "endmarker"};
-
-struct eventprofile {
-  long long totaltimestarts;
-  long long totaltimestops;
-  int numstarts;
-  int numstops;
-};
-
-struct coreprofile {
-  struct eventprofile events[EV_NUMEVENTS];
-};
-
-struct profiledata {
-  struct coreprofile cores[NUMCORES];
-};
-
-extern struct profiledata * eventdata;
-
-void startEvent(enum eventtypes event);
-void stopEvent(enum eventtypes event);
-void printResults();
-
-#endif
index fabca9f2d807062870236de55a0c7dd8cd2d4be4..827b23ec02fba2226222f5dda39b10c172a877e8 100644 (file)
@@ -286,6 +286,7 @@ void CALL11(___System______exit____I,
     BAMBOO_PRINT(0xbbbbbbbb);
     CACHEADAPT_DISABLE_TIMER();
     GC_OUTPUT_PROFILE_DATA();
+    gc_outputProfileDataReadable();
   }
 #endif 
   BAMBOO_EXIT_APP(___status___);
@@ -751,6 +752,7 @@ void checkCoreStatus() {
           getprofiledata_I();
           CACHEADAPT_DISABLE_TIMER();
           GC_OUTPUT_PROFILE_DATA();
+         gc_outputProfileDataReadable();
           disruntimedata();
           BAMBOO_ENTER_CLIENT_MODE_FROM_RUNTIME();
           terminate();  // All done.