fix profile code
[IRC.git] / Robust / src / Runtime / bamboo / multicoregcprofile.h
index 9b6c906e2a5493220e651019ee732f90ba0b3329..9ddbf86aaa83a82c227646a23153a165326cd95b 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef BAMBOO_MULTICORE_GC_PROFILE_H
 #define BAMBOO_MULTICORE_GC_PROFILE_H
-#ifdef MULTICORE_GC
+#if defined(MULTICORE_GC)||defined(PMC_GC)
 #include "multicore.h"
 #include "runtime_arch.h"
 #include "structdefs.h"
@@ -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;
@@ -111,11 +112,15 @@ INLINE static void gc_profileEnd(void) {
 #define GCPROFILE_RECORD_SPACE() \
   { \
     if(gc_profile_flag) { \
-      gc_num_livespace = 0; \
-      for(int tmpi = 0; tmpi < GCNUMBLOCK; tmpi++) { \
-        gc_num_livespace += bamboo_smemtbl[tmpi]; \
+      gc_num_freespace = 0; \
+      block_t lowestblock=allocationinfo.lowestfreeblock; \
+      for(block_t searchblock=lowestblock;searchblock<GCNUMBLOCK;searchblock++) { \
+        struct blockrecord * block=&allocationinfo.blocktable[searchblock]; \
+        if (block->status==BS_FREE) { \
+          gc_num_freespace+=block->freespace&~BAMBOO_CACHE_LINE_MASK; \
+        } \
       } \
-      gc_num_freespace = (BAMBOO_SHARED_MEM_SIZE) - gc_num_livespace; \
+      gc_num_livespace = (BAMBOO_SHARED_MEM_SIZE) - gc_num_freespace; \
     } \
   }
 // record forward obj info