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 #include "ac_stats.H"
00030 #include "ac_types.H"
00031
00032
00034 ac_stats::ac_stats():INIT_STO_STATS{
00035
00036 int i;
00038 for( i = 0; i<= AC_DEC_INSTR_NUMBER; i++)
00039 instr_table[i][0] = instr_table[i][1] = instr_table[i][2]= 0;
00040
00041 instr_executed = 0;
00042 init_stat();
00043 }
00044
00045
00046
00048 void ac_stats::print( ){
00049
00050 int i;
00051
00052 ac_sto_stats *pstats;
00053
00054 output << flush;
00055 output << "********************************************" << endl;
00056 output << "* ArchC Simulation Statistics Report *" << endl;
00057 output << "********************************************" << endl;
00058
00059 output << endl;
00060
00061 output << "Simulation time: " << time << endl;
00062 output << "Total of Executed Instructions: " << instr_executed << endl;
00063
00064 output << endl;
00065
00066 #ifdef AC_CYCLE_RANGE
00067 output << "Cycle count estimates "<< endl;
00068 output << "Minimum number of cycles: " << ac_min_cycle_count << endl;
00069 output << "Maximum number of cycles: " << ac_max_cycle_count << endl;
00070
00071 output << endl;
00072 #endif
00073
00074 output << "=> Instruction Set Statistics: " << endl << endl;
00075
00076 for( i =1; i<= AC_DEC_INSTR_NUMBER; i++) {
00077
00078 if( instr_table[i][2] ){
00079 output << ((ac_instruction *)instr_table[i][1])->get_name();
00080 output << " was executed " << instr_table[i][2] << " times." << endl;
00081 }
00082 }
00083 output << endl;
00084
00085 output << "=> Storage Statistics: " << endl << endl;
00086
00087 for ( pstats = head; pstats != NULL; pstats = pstats->next ){
00088
00089 output << "Device " << pstats->get_name() << " was accessed " << pstats->get_accesses() << " times";
00090
00091 if( pstats->get_misses() )
00092 {
00093 output << " and had " << pstats->get_misses() << " misses. " ;
00094 output.setf(ios::fixed);
00095 output.precision(2);
00096 output << "(Miss Rate: " << (float)100*pstats->get_misses()/pstats->get_accesses() << "%)" << endl;
00097 }
00098 else
00099 output << "." << endl;
00100 }
00101
00102
00103 };