[88] | 1 | #ifdef STATISTICS |
---|
| 2 | /* |
---|
| 3 | * $Id: Commit_unit_statistics_allocation.cpp 142 2010-08-04 20:09:03Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h" |
---|
[142] | 10 | #include "Behavioural/include/Allocation.h" |
---|
[88] | 11 | |
---|
| 12 | namespace morpheo { |
---|
| 13 | namespace behavioural { |
---|
| 14 | namespace core { |
---|
| 15 | namespace multi_ooo_engine { |
---|
| 16 | namespace ooo_engine { |
---|
| 17 | namespace commit_unit { |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #undef FUNCTION |
---|
| 21 | #define FUNCTION "Commit_unit::statistics_allocation" |
---|
| 22 | void Commit_unit::statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics) |
---|
| 23 | { |
---|
| 24 | log_begin(Commit_unit,FUNCTION); |
---|
| 25 | |
---|
| 26 | _stat = new Stat (static_cast<std::string>(_name), |
---|
| 27 | "Commit_unit", |
---|
| 28 | param_statistics); |
---|
| 29 | |
---|
[124] | 30 | _stat_nb_cycle_state_no_event = new counter_t * [_param->_nb_thread]; |
---|
| 31 | _stat_nb_cycle_state_not_yet_event = new counter_t * [_param->_nb_thread]; |
---|
| 32 | _stat_nb_cycle_state_event = new counter_t * [_param->_nb_thread]; |
---|
| 33 | _stat_nb_cycle_state_wait_end = new counter_t * [_param->_nb_thread]; |
---|
| 34 | |
---|
| 35 | { |
---|
| 36 | for (uint32_t i=0; i<_param->_nb_thread; i++) |
---|
| 37 | if (_param->_have_thread [i]) |
---|
| 38 | { |
---|
| 39 | _stat_nb_cycle_state_no_event [i] = _stat->create_variable("nb_cycle_state_no_event_" +toString(i)); |
---|
| 40 | _stat_nb_cycle_state_not_yet_event [i] = _stat->create_variable("nb_cycle_state_not_yet_event_"+toString(i)); |
---|
| 41 | _stat_nb_cycle_state_event [i] = _stat->create_variable("nb_cycle_state_event_" +toString(i)); |
---|
| 42 | _stat_nb_cycle_state_wait_end [i] = _stat->create_variable("nb_cycle_state_wait_end_" +toString(i)); |
---|
| 43 | |
---|
| 44 | _stat->create_expr_percent("percent_state_no_event_" +toString(i),"nb_cycle_state_no_event_" +toString(i),"cycle",toString(_("Percent of cycle in state no_event (context %d)"),i)); |
---|
| 45 | _stat->create_expr_percent("percent_state_not_yet_event_" +toString(i),"nb_cycle_state_not_yet_event_" +toString(i),"cycle",toString(_("Percent of cycle in state not_yet_event (context %d)"),i)); |
---|
| 46 | _stat->create_expr_percent("percent_state_event_" +toString(i),"nb_cycle_state_event_" +toString(i),"cycle",toString(_("Percent of cycle in state event (context %d)"),i)); |
---|
| 47 | _stat->create_expr_percent("percent_state_wait_end_" +toString(i),"nb_cycle_state_wait_end_" +toString(i),"cycle",toString(_("Percent of cycle in state wait_end (context %d)"),i)); |
---|
| 48 | } |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | _stat_nb_inst_retire_ok = new counter_t * [_param->_nb_thread]; |
---|
| 52 | _stat_nb_inst_retire_ko = new counter_t * [_param->_nb_thread]; |
---|
[137] | 53 | _stat_nb_inst_instruction = new counter_t * [NB_INSTRUCTION]; |
---|
[124] | 54 | _stat_nb_inst_type = new counter_t * [_param->_nb_type]; |
---|
| 55 | _stat_bank_nb_inst = new counter_t * [_param->_nb_bank]; |
---|
[137] | 56 | |
---|
[88] | 57 | { |
---|
[110] | 58 | std::string sum_nb_inst_retire_ok = "0"; |
---|
| 59 | std::string sum_nb_inst_retire_ko = "0"; |
---|
[111] | 60 | std::string sum_average; |
---|
[110] | 61 | for (uint32_t i=0; i<_param->_nb_thread; i++) |
---|
| 62 | if (_param->_have_thread [i]) |
---|
| 63 | { |
---|
| 64 | _stat_nb_inst_retire_ok [i] = _stat->create_variable("nb_inst_retire_ok_"+toString(i)); |
---|
| 65 | _stat_nb_inst_retire_ko [i] = _stat->create_variable("nb_inst_retire_ko_"+toString(i)); |
---|
| 66 | |
---|
| 67 | sum_nb_inst_retire_ok = "+ nb_inst_retire_ok_"+toString(i) + " " +sum_nb_inst_retire_ok; |
---|
| 68 | sum_nb_inst_retire_ko = "+ nb_inst_retire_ko_"+toString(i) + " " +sum_nb_inst_retire_ko; |
---|
[111] | 69 | sum_average = "+ average_inst_retire_ok_"+toString(i)+" average_inst_retire_ko_"+toString(i); |
---|
| 70 | |
---|
| 71 | _stat->create_expr_average_by_cycle("average_inst_retire_ok_"+toString(i),"nb_inst_retire_ok_"+toString(i), "", toString(_("Average instruction retire ok by cycle (thread %d)"),i)); |
---|
| 72 | _stat->create_expr_average_by_cycle("average_inst_retire_ko_"+toString(i),"nb_inst_retire_ko_"+toString(i), "", toString(_("Average instruction retire ko (event, miss) by cycle (thread %d)"),i)); |
---|
[110] | 73 | |
---|
[111] | 74 | _stat->create_expr_percent ("percent_inst_retire_ok_"+toString(i),"average_inst_retire_ok_"+toString(i), sum_average, toString(_("Percent instruction retire ok by cycle (thread %d)"),i)); |
---|
| 75 | _stat->create_expr_percent ("percent_inst_retire_ko_"+toString(i),"average_inst_retire_ko_"+toString(i), sum_average, toString(_("Percent instruction retire ko by cycle (thread %d)"),i)); |
---|
| 76 | |
---|
[110] | 77 | _stat->create_expr ("IPC_ok_"+toString(i) , "average_inst_retire_ok_"+toString(i), TYPE_COUNTER, "inst/cycle", toString("Instruction Per Cycle (Instruction Ok) (thread %d)",i)); |
---|
| 78 | _stat->create_expr ("CPI_ok_"+toString(i) , "/ 1 IPC_ok_"+toString(i) , TYPE_COUNTER, "cycle/inst", toString("Cycle Per Instruction (Instruction Ok) (thread %d)",i)); |
---|
| 79 | |
---|
| 80 | _stat->create_expr ("IPC_ko_"+toString(i) , "average_inst_retire_ko_"+toString(i), TYPE_COUNTER, "inst/cycle", toString("Instruction Per Cycle (Instruction Ko) (thread %d)",i)); |
---|
| 81 | _stat->create_expr ("CPI_ko_"+toString(i) , "/ 1 IPC_ko_"+toString(i) , TYPE_COUNTER, "cycle/inst", toString("Cycle Per Instruction (Instruction Ko) (thread %d)",i)); |
---|
| 82 | |
---|
| 83 | _stat->create_expr ("IPC_all_"+toString(i), "+ IPC_ok_"+toString(i)+" IPC_ko_"+toString(i), TYPE_COUNTER, "inst/cycle", toString("Instruction Per Cycle (Instruction Ok and Ko) (thread %d)",i)); |
---|
| 84 | _stat->create_expr ("CPI_all_"+toString(i), "/ 1 IPC_all_"+toString(i) , TYPE_COUNTER, "cycle/inst", toString("Cycle Per Instruction (Instruction Ok and Ko) (thread %d)",i)); |
---|
| 85 | } |
---|
| 86 | |
---|
[111] | 87 | _stat->create_expr_average_by_cycle("average_inst_retire_ok", sum_nb_inst_retire_ok, "", _("Average instruction retire ok by cycle (all thread)")); |
---|
| 88 | _stat->create_expr_average_by_cycle("average_inst_retire_ko", sum_nb_inst_retire_ko, "", _("Average instruction retire ko (event, miss) by cycle (all thread)")); |
---|
| 89 | |
---|
| 90 | sum_average = "+ average_inst_retire_ok average_inst_retire_ko"; |
---|
| 91 | |
---|
| 92 | _stat->create_expr_percent ("percent_inst_retire_ok","average_inst_retire_ok", sum_average, _("Percent instruction retire ok by cycle (all thread)")); |
---|
| 93 | _stat->create_expr_percent ("percent_inst_retire_ko","average_inst_retire_ko", sum_average, _("Percent instruction retire ko by cycle (all thread)")); |
---|
| 94 | |
---|
[110] | 95 | _stat->create_expr ("IPC_ok" , "/ "+sum_nb_inst_retire_ok+" cycle", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ok)"); |
---|
[109] | 96 | _stat->create_expr ("CPI_ok" , "/ 1 IPC_ok" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ok)"); |
---|
| 97 | |
---|
[110] | 98 | _stat->create_expr ("IPC_ko" , "/ "+sum_nb_inst_retire_ko+" cycle", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ko)"); |
---|
[109] | 99 | _stat->create_expr ("CPI_ko" , "/ 1 IPC_ko" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ko)"); |
---|
| 100 | |
---|
[110] | 101 | _stat->create_expr ("IPC_all", "+ IPC_ok IPC_ko" , TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ok and Ko)"); |
---|
[109] | 102 | _stat->create_expr ("CPI_all", "/ 1 IPC_all" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ok and Ko)"); |
---|
[88] | 103 | } |
---|
| 104 | |
---|
[110] | 105 | { |
---|
| 106 | std::string sum_nb_inst_type = "0"; |
---|
| 107 | |
---|
| 108 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
[137] | 109 | if (is_type_valid(i)) |
---|
[110] | 110 | { |
---|
| 111 | _stat_nb_inst_type [i] = _stat->create_variable("nb_inst_type_"+toString(i)); |
---|
| 112 | |
---|
| 113 | sum_nb_inst_type = "+ nb_inst_type_"+toString(i) + " " +sum_nb_inst_type; |
---|
| 114 | } |
---|
| 115 | |
---|
| 116 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
| 117 | if (is_type_valid(i)) |
---|
| 118 | { |
---|
[137] | 119 | std::string name = toString(static_cast<type_t>(i)); |
---|
| 120 | |
---|
| 121 | _stat->create_expr_percent ("percent_type_"+toString(name), "nb_inst_type_"+toString(i), sum_nb_inst_type, toString(_("Percent instruction retire ok by cycle (type %s)"),name.c_str())); |
---|
[110] | 122 | } |
---|
| 123 | } |
---|
| 124 | |
---|
[137] | 125 | { |
---|
| 126 | std::string sum_nb_inst_instruction = "0"; |
---|
| 127 | |
---|
| 128 | for (uint32_t i=0; i<NB_INSTRUCTION; i++) |
---|
| 129 | { |
---|
| 130 | _stat_nb_inst_instruction [i] = _stat->create_variable("nb_inst_instruction_"+toString(i)); |
---|
| 131 | |
---|
| 132 | sum_nb_inst_instruction = "+ nb_inst_instruction_"+toString(i) + " " +sum_nb_inst_instruction; |
---|
| 133 | } |
---|
| 134 | |
---|
| 135 | for (uint32_t i=0; i<NB_INSTRUCTION; i++) |
---|
| 136 | { |
---|
| 137 | std::string name = toString_instruction(i).c_str(); |
---|
| 138 | |
---|
| 139 | _stat->create_expr_percent ("percent_instruction_"+toString(name), "nb_inst_instruction_"+toString(i), sum_nb_inst_instruction, toString(_("Percent instruction retire ok by cycle (instruction %s)"),name.c_str())); |
---|
| 140 | } |
---|
| 141 | } |
---|
| 142 | |
---|
[88] | 143 | // bank/queue occupation |
---|
| 144 | { |
---|
| 145 | std::string sum_bank_nb_inst = ""; |
---|
| 146 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 147 | { |
---|
| 148 | _stat_bank_nb_inst [i] = _stat->create_variable("bank_nb_inst_"+toString(i)); |
---|
| 149 | |
---|
| 150 | _stat->create_expr_average_by_cycle("average_occupation_bank_"+toString(i), "bank_nb_inst_"+toString(i), "", toString(_("Average instruction by cycle (bank %d)"),i)); |
---|
| 151 | _stat->create_expr_percent ("percent_occupation_bank_"+toString(i), "average_occupation_bank_"+toString(i), toString(_param->_size_bank), toString(_("Percent occupation of bank (bank %d)"),i)); |
---|
| 152 | |
---|
| 153 | if (i == 0) |
---|
| 154 | sum_bank_nb_inst = "bank_nb_inst_"+toString(i); |
---|
| 155 | else |
---|
| 156 | sum_bank_nb_inst = "+ bank_nb_inst_"+toString(i) + " " +sum_bank_nb_inst; |
---|
| 157 | } |
---|
| 158 | |
---|
| 159 | _stat->create_expr_average_by_cycle("average_occupation_bank", sum_bank_nb_inst, "", _("Average instruction by cycle (all bank)")); |
---|
| 160 | _stat->create_expr_percent ("percent_occupation_bank" , "average_occupation_bank", toString(_param->_size_queue), _("Percent occupation of Re-Order-Buffer (all bank)")); |
---|
| 161 | } |
---|
| 162 | |
---|
[141] | 163 | _stat_nb_inst_insert = new counters_t * [_param->_nb_rename_unit]; |
---|
| 164 | _stat_nb_inst_retire = new counters_t * [_param->_nb_rename_unit]; |
---|
| 165 | _stat_nb_inst_commit = new counters_t * [_param->_nb_rename_unit]; |
---|
[88] | 166 | |
---|
[141] | 167 | std::string average_nb_inst_commit = "0"; |
---|
| 168 | |
---|
| 169 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 170 | { |
---|
| 171 | _stat_nb_inst_insert [i] = _stat->create_counters("nb_inst_insert_"+toString(i),_param->_nb_inst_insert[i],"", |
---|
[142] | 172 | _("Cycle number with %d instruction(s) included ")+toString(_("(rename_unit %d)."),i), |
---|
| 173 | _("Percent of cycle number with %d instruction(s) included ")+toString(_("(rename_unit %d)."),i), |
---|
| 174 | _("Average of instruction(s) included ")+toString(_("(rename_unit %d)."),i) |
---|
| 175 | ); |
---|
[141] | 176 | |
---|
| 177 | _stat_nb_inst_retire [i] = _stat->create_counters("nb_inst_retire_"+toString(i),_param->_nb_inst_retire[i],"", |
---|
[142] | 178 | _("Cycle number with %d instruction(s) removed ")+toString(_("(rename_unit %d)."),i), |
---|
| 179 | _("Percent of cycle number with %d instruction(s) removed ")+toString(_("(rename_unit %d)."),i), |
---|
| 180 | _("Average of instruction(s) removed ")+toString(_("(rename_unit %d)."),i) |
---|
| 181 | ); |
---|
[141] | 182 | |
---|
| 183 | _stat_nb_inst_commit [i] = _stat->create_counters("nb_inst_commit_"+toString(i),_param->_nb_inst_commit,"", |
---|
[142] | 184 | _("Cycle number with %d instruction(s) commited ")+toString(_("(rename_unit %d)."),i), |
---|
| 185 | _("Percent of cycle number with %d instruction(s) commited ")+toString(_("(rename_unit %d)."),i), |
---|
| 186 | _("Average of instruction(s) commited ")+toString(_("(rename_unit %d)."),i) |
---|
| 187 | ); |
---|
[141] | 188 | |
---|
| 189 | average_nb_inst_commit = "+ average_nb_inst_commit_"+toString(i) + " " + average_nb_inst_commit; |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | _stat_nb_inst_commit_conflit_access = _stat->create_variable("nb_inst_commit_conflit_access"); |
---|
| 193 | _stat->create_expr_average_by_cycle("average_use_interface_commit_conflit_access","nb_inst_commit_conflit_access", "", _("Average access conflit by cycle on commit interface")); |
---|
| 194 | _stat->create_expr_percent ("percent_use_interface_commit_conflit_access","average_use_interface_commit_conflit_access", average_nb_inst_commit, _("Percent access conflit on commit interface")); |
---|
| 195 | |
---|
[142] | 196 | |
---|
| 197 | // ALLOC1(_stat_last_inst ,uint32_t ,_param->_nb_thread); |
---|
| 198 | ALLOC1(_stat_last_inst_type ,uint32_t ,_param->_nb_thread); |
---|
| 199 | ALLOC1(_stat_last_inst_operation,uint32_t ,_param->_nb_thread); |
---|
| 200 | ALLOC1(_stat_inst_fusion ,stat_inst_fusion_t,_param->_nb_thread); |
---|
| 201 | |
---|
| 202 | for (uint32_t i=0; i<_param->_nb_thread; ++i) |
---|
| 203 | { |
---|
| 204 | //_stat_last_inst [i] = INSTRUCTION_L_NOP; |
---|
| 205 | _stat_last_inst_type [i] = instruction_information(INSTRUCTION_L_NOP)._type ; |
---|
| 206 | _stat_last_inst_operation [i] = instruction_information(INSTRUCTION_L_NOP)._operation; |
---|
| 207 | } |
---|
| 208 | |
---|
[88] | 209 | log_end(Commit_unit,FUNCTION); |
---|
| 210 | }; |
---|
| 211 | |
---|
| 212 | }; // end namespace commit_unit |
---|
| 213 | }; // end namespace ooo_engine |
---|
| 214 | }; // end namespace multi_ooo_engine |
---|
| 215 | }; // end namespace core |
---|
| 216 | |
---|
| 217 | }; // end namespace behavioural |
---|
| 218 | }; // end namespace morpheo |
---|
| 219 | #endif |
---|