1 #if (defined(MULTICORE_GC)||defined(PMC_GC))&&defined(GC_PROFILE)
2 #include "multicoregcprofile.h"
3 #include "structdefs.h"
4 #include "runtime_arch.h"
7 void initmulticoregcprofiledata() {
8 if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
9 // startup core to initialize corestatus[]
11 gc_infoOverflow = false;
15 gc_size_allocatedobj = 0;
17 gc_num_forwardobj = 0;
18 gc_num_profiles = NUMCORESACTIVE - 1;
21 // output the profiling data
22 void gc_outputProfileData() {
25 unsigned long long totalgc = 0;
27 #ifndef BAMBOO_MEMPROF
30 // output task related info
31 for(i= 0; i < gc_infoIndex; i++) {
32 GCInfo * gcInfo = gc_infoArray[i];
34 unsigned long long tmp=gcInfo->time[gcInfo->index-8]-gcInfo->time[0]; //0;
36 unsigned long long tmp = 0;
38 for(j = 0; j < gcInfo->index - 7; j++) {
39 BAMBOO_PRINT(gcInfo->time[j]);
40 BAMBOO_PRINT(gcInfo->time[j]-tmp);
42 tmp = gcInfo->time[j];
44 tmp = (tmp-gcInfo->time[0]);
45 BAMBOO_PRINT_REG(tmp);
47 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 7]);
48 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 6]);
49 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 5]);
50 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 4]);
51 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 3]);
52 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 2]);
53 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 1]);
58 #ifndef BAMBOO_MEMPROF
61 BAMBOO_PRINT_REG(totalgc);
67 #ifndef BAMBOO_MEMPROF
72 // output the profiling data
73 void gc_outputProfileDataReadable() {
74 // output task related info
75 for(int i= 0; i < gc_infoIndex; i++) {
76 GCInfo * gcInfo = gc_infoArray[i];
78 unsigned long long starttime=gcInfo->time[0]; //0;
80 for(int j = 1; j < gcInfo->index - 7; j++) {
81 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]);
83 printf("Livespace %llu\n", gcInfo->time[gcInfo->index-7]);
84 printf("Freespace %llu\n", gcInfo->time[gcInfo->index-6]);
85 printf("# Lobj %llu\n", gcInfo->time[gcInfo->index-5]);
86 printf("Lobj space %llu\n", gcInfo->time[gcInfo->index-4]);
87 printf("# obj allocated %llu\n", gcInfo->time[gcInfo->index-3]);
88 printf("# live obj %llu\n", gcInfo->time[gcInfo->index-2]);
89 printf("# forward obj %llu\n", gcInfo->time[gcInfo->index-1]);
92 #endif // MULTICORE_GC