00001 /* 00002 * ===================================================================================== 00003 * 00004 * Filename: stats.cc 00005 * 00006 * Description: 00007 * 00008 * Version: 1.0 00009 * Created: 09/01/2010 02:37:01 PM 00010 * Revision: none 00011 * Compiler: gcc 00012 * 00013 * Author: Mitchelle Rasquinha (), mitchelle.rasquinha@gatech.edu 00014 * Company: Georgia Institute of Technology 00015 * 00016 * ===================================================================================== 00017 */ 00018 00019 #ifndef _STATS_CC_INC 00020 #define _STATS_CC_INC 00021 00022 #include "stats.h" 00023 using namespace std; 00024 00025 StatRouter::StatRouter() 00026 { 00027 ib_cycles = 0; 00028 rc_cycles = 0; 00029 vca_cycles = 0; 00030 sa_cycles = 0; 00031 st_cycles = 0; 00032 } 00033 00034 StatLink::StatLink() 00035 { 00036 credits_transferred = 0; 00037 flits_transferred = 0; 00038 } 00039 00040 00041 /* 00042 *-------------------------------------------------------------------------------------- 00043 * Class: IrisStats 00044 * Method: IrisStats 00045 * Description: constructor 00046 *-------------------------------------------------------------------------------------- 00047 */ 00048 IrisStats::IrisStats () 00049 { 00050 stat_router.clear(); 00051 stat_link.clear(); 00052 } /* ----- end of method IrisStats::IrisStats (constructor) ----- */ 00053 00054 IrisStats::~IrisStats () 00055 { 00056 } /* ----- end of method IrisStats::~IrisStats ----- */ 00057 00058 void 00059 IrisStats::init( void ) 00060 { 00061 for( uint i=0; i<no_nodes; i++) 00062 stat_router.push_back( new StatRouter() ); 00063 for( uint i=0; i<2*links; i++) 00064 stat_link.push_back( new StatLink() ); 00065 00066 } 00067 /* 00068 * === FUNCTION ====================================================================== 00069 * Name: compute_total_buffer_dyn_energy 00070 * Description: 00071 * ===================================================================================== 00072 */ 00073 double 00074 IrisStats::compute_total_buffer_dyn_energy ( double en ) 00075 { 00076 double total_en = 0.0; 00077 for( uint i=0; i<no_nodes; i++) 00078 total_en += stat_router[i]->ib_cycles * en; 00079 00080 return total_en; 00081 } /* ----- end of method IrisStats::compute_total_buffer_dyn_energy ----- */ 00082 00083 00084 /* 00085 * === FUNCTION ====================================================================== 00086 * Name: compute_total_router_dyn_energy 00087 * Description: 00088 * ===================================================================================== 00089 */ 00090 double 00091 IrisStats::compute_total_router_dyn_energy ( double en ) 00092 { 00093 double total_en = 0.0; 00094 for( uint i=0; i<no_nodes; i++) 00095 total_en += (stat_router[i]->ib_cycles + stat_router[i]->rc_cycles + stat_router[i]->vca_cycles + stat_router[i]->sa_cycles + stat_router[i]->st_cycles)* en; 00096 00097 return total_en; 00098 } /* ----- end of method IrisStats::compute_total_router_dyn_energy ----- */ 00099 00100 /* 00101 * === FUNCTION ====================================================================== 00102 * Name: compute_total_arbiter_dyn_energy 00103 * Description: 00104 * ===================================================================================== 00105 */ 00106 double 00107 IrisStats::compute_total_arbiter_dyn_energy ( double en ) 00108 { 00109 double total_en = 0.0; 00110 for( uint i=0; i<no_nodes; i++) 00111 total_en += (stat_router[i]->vca_cycles + stat_router[i]->sa_cycles/vcs )* en; 00112 00113 return total_en; 00114 } /* ----- end of method IrisStats::compute_total_arbiter_dyn_energy ----- */ 00115 00116 /* 00117 * === FUNCTION ====================================================================== 00118 * Name: compute_total_vc_arbiter_dyn_energy 00119 * Description: 00120 * ===================================================================================== 00121 */ 00122 double 00123 IrisStats::compute_total_vc_arbiter_dyn_energy ( double en ) 00124 { 00125 double total_en = 0.0; 00126 for( uint i=0; i<no_nodes; i++) 00127 total_en += (stat_router[i]->vca_cycles)* en; 00128 00129 return total_en; 00130 } /* ----- end of method IrisStats::compute_total_vc_arbiter_dyn_energy ----- */ 00131 00132 /* 00133 * === FUNCTION ====================================================================== 00134 * Name: compute_total_crossbar_dyn_energy 00135 * Description: 00136 * ===================================================================================== 00137 */ 00138 double 00139 IrisStats::compute_total_crossbar_dyn_energy ( double en ) 00140 { 00141 double total_en = 0.0; 00142 for( uint i=0; i<no_nodes; i++) 00143 total_en += (stat_router[i]->st_cycles * en); 00144 00145 return total_en; 00146 } /* ----- end of method IrisStats::compute_total_crossbar_dyn_energy ----- */ 00147 00154 double 00155 IrisStats::compute_total_link_dyn_energy ( double en ) 00156 { 00157 double total_en = 0.0; 00158 for( uint i=0; i<2*links; i++) 00159 total_en += (stat_link[i]->credits_transferred + stat_link[i]->flits_transferred)* en; 00160 00161 return total_en; 00162 } /* ----- end of method IrisStats::compute_total_link_dyn_energy ----- */ 00163 00164 ullint 00165 IrisStats::get_total_ib_cycles ( void ) 00166 { 00167 ullint total = 0; 00168 for( uint i=0; i<no_nodes; i++) 00169 total += stat_router[i]->ib_cycles; 00170 00171 return total; 00172 } 00173 00174 ullint 00175 IrisStats::get_total_rc_cycles ( void ) 00176 { 00177 ullint total = 0; 00178 for( uint i=0; i<no_nodes; i++) 00179 total += stat_router[i]->rc_cycles; 00180 00181 return total; 00182 } 00183 00184 ullint 00185 IrisStats::get_total_vca_cycles ( void ) 00186 { 00187 ullint total = 0; 00188 for( uint i=0; i<no_nodes; i++) 00189 total += stat_router[i]->vca_cycles; 00190 00191 return total; 00192 } 00193 00194 ullint 00195 IrisStats::get_total_sa_cycles ( void ) 00196 { 00197 ullint total = 0; 00198 for( uint i=0; i<no_nodes; i++) 00199 total += stat_router[i]->sa_cycles; 00200 00201 return total; 00202 } 00203 00204 ullint 00205 IrisStats::get_total_st_cycles ( void ) 00206 { 00207 ullint total = 0; 00208 for( uint i=0; i<no_nodes; i++) 00209 total += stat_router[i]->st_cycles; 00210 00211 return total; 00212 } 00213 00214 ullint 00215 IrisStats::get_total_flits_passed( void ) 00216 { 00217 ullint total = 0; 00218 for( uint i=0; i<2*links; i++) 00219 total += stat_link[i]->flits_transferred; 00220 00221 return total; 00222 } 00223 00224 ullint 00225 IrisStats::get_total_credits_passed( void ) 00226 { 00227 ullint total = 0; 00228 for( uint i=0; i<2*links; i++) 00229 total += stat_link[i]->credits_transferred; 00230 00231 return total; 00232 } 00233 00234 #endif /* ----- #ifndef _STATS_CC_INC ----- */