00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include "dump_feedback.h"
00045 #include <stdio.h>
00046
00047 extern char* Cur_PU_Name;
00048 extern char* Src_File_Name;
00049
00050
00051 void Dump_Edge_Info(BB* source_bb,BBLIST* edge,FILE* fp)
00052 {
00053 BB* target_bb = BBLIST_item(edge);
00054 fprintf(fp,"Freq:%f Source BB:%d-->Target BB:%d\n",BBLIST_freq(edge),
00055 BB_id(source_bb),BB_id(target_bb));
00056 }
00057
00058
00059 void Dump_Fb_Data(PU_PROFILE_HANDLES fb_handles,FILE* fp)
00060 {
00061
00062 fprintf(fp,"\n======= Cur PU Name:");
00063 fprintf(fp,Cur_PU_Name);
00064 fprintf(fp,"=========\n");
00065
00066 FB_Info_Call info_call( FB_FREQ_ZERO );
00067 FB_Info_Branch info_branch( FB_FREQ_ZERO, FB_FREQ_ZERO );
00068 FB_Info_Invoke info_invoke( FB_FREQ_ZERO );
00069 FB_Info_Edge info_edge( FB_FREQ_ZERO );
00070 FB_Info_Value info_value;
00071 FB_Info_Value info_stride;
00072
00073 for (PU_PROFILE_ITERATOR i( fb_handles.begin() ); i != fb_handles.end (); ++i)
00074 {
00075 PU_Profile_Handle * handle=*i;
00076 for(int id=0;id < handle->Call_Profile_Table.size();id++){
00077 info_call = FB_FREQ_ZERO;
00078 FB_Info_Call& info = Get_Call_Profile( *i, id );
00079 info_call.freq_entry += info.freq_entry;
00080 info_call.freq_exit += info.freq_exit;
00081 info_call.Print(fp);
00082 fprintf(fp,"\n");
00083 }
00084 for(int id=0;id< handle->Branch_Profile_Table.size();id++){
00085 FB_Info_Branch& info = Get_Branch_Profile( *i, id );
00086 info_branch.freq_taken += info.freq_taken;
00087 info_branch.freq_not_taken += info.freq_not_taken;
00088 info_branch.Print(fp);
00089 fprintf(fp,"\n");
00090 }
00091
00092 for(int id=0;id< handle->Invoke_Profile_Table.size();id++){
00093 FB_Info_Invoke& info = Get_Invoke_Profile( *i, id );
00094 info_invoke = FB_FREQ_ZERO;
00095 info_invoke.freq_invoke += info.freq_invoke;
00096 info_invoke.Print(fp);
00097 fprintf(fp,"\n");
00098 }
00099 for(int id=0;id< handle->Edge_Profile_Table.size();id++){
00100 FB_Info_Edge& info = Get_Edge_Profile( *i, id );
00101 info_edge = FB_FREQ_ZERO;
00102 info_edge.freq_edge += info.freq_edge;
00103 info_edge.Print(fp);
00104 fprintf(fp,"\n");
00105 }
00106 for(int id=0;id< handle->Value_Profile_Table.size();id++){
00107 FB_Info_Value& info = Get_Value_Profile( *i, id );
00108 info_value = info;
00109 info_value.Print(fp);
00110 fprintf(fp,"\n");
00111 }
00112 for(int id=0;id< handle->Stride_Profile_Table.size();id++){
00113 FB_Info_Value& info = Get_Stride_Profile( *i, id );
00114 info_stride = info;
00115 info_stride.Print(fp);
00116 fprintf(fp,"\n");
00117 }
00118 }
00119 }