3 #include "multicoregcprofile.h"
4 #include "runtime_arch.h"
5 #include "structdefs.h"
10 INLINE void initmulticoregcprofiledata() {
11 if(STARTUPCORE == BAMBOO_NUM_OF_CORE) {
12 // startup core to initialize corestatus[]
14 gc_infoOverflow = false;
20 gc_num_forwardobj = 0;
21 gc_num_profiles = NUMCORESACTIVE - 1;
24 INLINE void gc_profileInit() {
30 gc_num_forwardobj = 0;
31 gc_num_profiles = NUMCORESACTIVE - 1;
34 INLINE void gc_profileStart(void) {
35 if(!gc_infoOverflow) {
36 GCInfo* gcInfo = RUNMALLOC(sizeof(struct gc_info));
37 gc_infoArray[gc_infoIndex] = gcInfo;
39 gcInfo->time[0] = BAMBOO_GET_EXE_TIME();
43 INLINE void gc_profileItem(void) {
44 if(!gc_infoOverflow) {
45 GCInfo* gcInfo = gc_infoArray[gc_infoIndex];
46 gcInfo->time[gcInfo->index++] = BAMBOO_GET_EXE_TIME();
50 INLINE void gc_profileEnd(void) {
51 if(!gc_infoOverflow) {
52 GCInfo* gcInfo = gc_infoArray[gc_infoIndex];
53 gcInfo->time[gcInfo->index++] = BAMBOO_GET_EXE_TIME();
54 gcInfo->time[gcInfo->index++] = gc_num_livespace;
55 gcInfo->time[gcInfo->index++] = gc_num_freespace;
56 gcInfo->time[gcInfo->index++] = gc_num_lobj;
57 gcInfo->time[gcInfo->index++] = gc_num_lobjspace;
58 gcInfo->time[gcInfo->index++] = gc_num_obj;
59 gcInfo->time[gcInfo->index++] = gc_num_liveobj;
60 gcInfo->time[gcInfo->index++] = gc_num_forwardobj;
62 if(gc_infoIndex == GCINFOLENGTH) {
63 gc_infoOverflow = true;
68 // output the profiling data
69 void gc_outputProfileData() {
72 unsigned long long totalgc = 0;
74 #ifndef BAMBOO_MEMPROF
77 // output task related info
78 for(i= 0; i < gc_infoIndex; i++) {
79 GCInfo * gcInfo = gc_infoArray[i];
81 unsigned long long tmp=gcInfo->time[gcInfo->index-8]-gcInfo->time[0]; //0;
83 unsigned long long tmp = 0;
85 for(j = 0; j < gcInfo->index - 7; j++) {
86 BAMBOO_PRINT(gcInfo->time[j]);
87 BAMBOO_PRINT(gcInfo->time[j]-tmp);
89 tmp = gcInfo->time[j];
91 tmp = (tmp-gcInfo->time[0]);
92 BAMBOO_PRINT_REG(tmp);
94 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 7]);
95 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 6]);
96 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 5]);
97 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 4]);
98 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 3]);
99 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 2]);
100 BAMBOO_PRINT(gcInfo->time[gcInfo->index - 1]);
101 BAMBOO_PRINT(0xddde);
105 #ifndef BAMBOO_MEMPROF
106 BAMBOO_PRINT(0xdddf);
108 BAMBOO_PRINT_REG(totalgc);
110 if(gc_infoOverflow) {
111 BAMBOO_PRINT(0xefee);
114 #ifndef BAMBOO_MEMPROF
115 BAMBOO_PRINT(0xeeee);
119 #endif // MULTICORE_GC