[88] | 1 | #ifdef STATISTICS |
---|
| 2 | /* |
---|
| 3 | * $Id: Commit_unit_statistics_allocation.cpp 111 2009-02-27 18:37:40Z rosiere $ |
---|
| 4 | * |
---|
| 5 | * [ Description ] |
---|
| 6 | * |
---|
| 7 | */ |
---|
| 8 | |
---|
| 9 | #include "Behavioural/Core/Multi_OOO_Engine/OOO_Engine/Commit_unit/include/Commit_unit.h" |
---|
| 10 | |
---|
| 11 | namespace morpheo { |
---|
| 12 | namespace behavioural { |
---|
| 13 | namespace core { |
---|
| 14 | namespace multi_ooo_engine { |
---|
| 15 | namespace ooo_engine { |
---|
| 16 | namespace commit_unit { |
---|
| 17 | |
---|
| 18 | |
---|
| 19 | #undef FUNCTION |
---|
| 20 | #define FUNCTION "Commit_unit::statistics_allocation" |
---|
| 21 | void Commit_unit::statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics) |
---|
| 22 | { |
---|
| 23 | log_begin(Commit_unit,FUNCTION); |
---|
| 24 | |
---|
| 25 | _stat = new Stat (static_cast<std::string>(_name), |
---|
| 26 | "Commit_unit", |
---|
| 27 | param_statistics); |
---|
| 28 | |
---|
| 29 | _stat_nb_inst_insert = new counter_t * [_param->_nb_rename_unit]; |
---|
[110] | 30 | _stat_nb_inst_retire = new counter_t * [_param->_nb_rename_unit]; |
---|
| 31 | _stat_nb_inst_retire_ok = new counter_t * [_param->_nb_thread]; |
---|
| 32 | _stat_nb_inst_retire_ko = new counter_t * [_param->_nb_thread]; |
---|
| 33 | _stat_nb_inst_type = new counter_t * [_param->_nb_type]; |
---|
[88] | 34 | _stat_bank_nb_inst = new counter_t * [_param->_nb_bank]; |
---|
| 35 | |
---|
| 36 | { |
---|
[98] | 37 | std::string sum_nb_inst_insert = "0"; |
---|
[110] | 38 | std::string sum_nb_inst_retire = "0"; |
---|
[88] | 39 | |
---|
| 40 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
| 41 | { |
---|
[98] | 42 | _stat_nb_inst_insert [i] = _stat->create_variable("nb_inst_insert_" +toString(i)); |
---|
[110] | 43 | _stat_nb_inst_retire [i] = _stat->create_variable("nb_inst_retire_" +toString(i)); |
---|
[88] | 44 | |
---|
| 45 | _stat->create_expr_average_by_cycle("average_use_interface_insert_"+toString(i), "nb_inst_insert_"+toString(i), "", toString(_("Average instruction by cycle on insert interface (rename_unit %d)"),i)); |
---|
[110] | 46 | _stat->create_expr_average_by_cycle("average_use_interface_retire_"+toString(i), "nb_inst_retire_"+toString(i), "", toString(_("Average instruction by cycle on retire interface (rename_unit %d)"),i)); |
---|
[88] | 47 | _stat->create_expr_percent ("percent_use_interface_insert_"+toString(i) , "average_use_interface_insert_"+toString(i), toString(_param->_nb_inst_insert [i]), toString(_("Percent usage of insert interface (rename_unit %d)"),i)); |
---|
| 48 | _stat->create_expr_percent ("percent_use_interface_retire_"+toString(i) , "average_use_interface_retire_"+toString(i), toString(_param->_nb_inst_retire [i]), toString(_("Percent usage of retire interface (rename_unit %d)"),i)); |
---|
| 49 | |
---|
[98] | 50 | sum_nb_inst_insert = "+ nb_inst_insert_"+ toString(i) + " " +sum_nb_inst_insert; |
---|
[110] | 51 | sum_nb_inst_retire = "+ nb_inst_retire_"+ toString(i) + " " +sum_nb_inst_retire; |
---|
| 52 | } |
---|
[88] | 53 | |
---|
[98] | 54 | _stat->create_expr_average_by_cycle("average_inst_insert" , sum_nb_inst_insert , "", _("Average instruction insert by cycle")); |
---|
[110] | 55 | _stat->create_expr_average_by_cycle("average_inst_retire" , sum_nb_inst_retire , "", _("Average instruction retire by cycle")); |
---|
| 56 | } |
---|
[100] | 57 | |
---|
[110] | 58 | { |
---|
| 59 | std::string sum_nb_inst_retire_ok = "0"; |
---|
| 60 | std::string sum_nb_inst_retire_ko = "0"; |
---|
[111] | 61 | std::string sum_average; |
---|
[110] | 62 | for (uint32_t i=0; i<_param->_nb_thread; i++) |
---|
| 63 | if (_param->_have_thread [i]) |
---|
| 64 | { |
---|
| 65 | _stat_nb_inst_retire_ok [i] = _stat->create_variable("nb_inst_retire_ok_"+toString(i)); |
---|
| 66 | _stat_nb_inst_retire_ko [i] = _stat->create_variable("nb_inst_retire_ko_"+toString(i)); |
---|
| 67 | |
---|
| 68 | sum_nb_inst_retire_ok = "+ nb_inst_retire_ok_"+toString(i) + " " +sum_nb_inst_retire_ok; |
---|
| 69 | sum_nb_inst_retire_ko = "+ nb_inst_retire_ko_"+toString(i) + " " +sum_nb_inst_retire_ko; |
---|
[111] | 70 | sum_average = "+ average_inst_retire_ok_"+toString(i)+" average_inst_retire_ko_"+toString(i); |
---|
| 71 | |
---|
| 72 | _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)); |
---|
| 73 | _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] | 74 | |
---|
[111] | 75 | _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)); |
---|
| 76 | _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)); |
---|
| 77 | |
---|
[110] | 78 | _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)); |
---|
| 79 | _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)); |
---|
| 80 | |
---|
| 81 | _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)); |
---|
| 82 | _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)); |
---|
| 83 | |
---|
| 84 | _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)); |
---|
| 85 | _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)); |
---|
| 86 | } |
---|
| 87 | |
---|
[111] | 88 | _stat->create_expr_average_by_cycle("average_inst_retire_ok", sum_nb_inst_retire_ok, "", _("Average instruction retire ok by cycle (all thread)")); |
---|
| 89 | _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)")); |
---|
| 90 | |
---|
| 91 | sum_average = "+ average_inst_retire_ok average_inst_retire_ko"; |
---|
| 92 | |
---|
| 93 | _stat->create_expr_percent ("percent_inst_retire_ok","average_inst_retire_ok", sum_average, _("Percent instruction retire ok by cycle (all thread)")); |
---|
| 94 | _stat->create_expr_percent ("percent_inst_retire_ko","average_inst_retire_ko", sum_average, _("Percent instruction retire ko by cycle (all thread)")); |
---|
| 95 | |
---|
[110] | 96 | _stat->create_expr ("IPC_ok" , "/ "+sum_nb_inst_retire_ok+" cycle", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ok)"); |
---|
[109] | 97 | _stat->create_expr ("CPI_ok" , "/ 1 IPC_ok" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ok)"); |
---|
| 98 | |
---|
[110] | 99 | _stat->create_expr ("IPC_ko" , "/ "+sum_nb_inst_retire_ko+" cycle", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ko)"); |
---|
[109] | 100 | _stat->create_expr ("CPI_ko" , "/ 1 IPC_ko" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ko)"); |
---|
| 101 | |
---|
[110] | 102 | _stat->create_expr ("IPC_all", "+ IPC_ok IPC_ko" , TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ok and Ko)"); |
---|
[109] | 103 | _stat->create_expr ("CPI_all", "/ 1 IPC_all" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ok and Ko)"); |
---|
[88] | 104 | } |
---|
| 105 | |
---|
[110] | 106 | { |
---|
| 107 | std::string sum_nb_inst_type = "0"; |
---|
| 108 | |
---|
| 109 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
| 110 | if (is_type_valid(i)) |
---|
| 111 | { |
---|
| 112 | _stat_nb_inst_type [i] = _stat->create_variable("nb_inst_type_"+toString(i)); |
---|
| 113 | |
---|
| 114 | sum_nb_inst_type = "+ nb_inst_type_"+toString(i) + " " +sum_nb_inst_type; |
---|
| 115 | } |
---|
| 116 | |
---|
| 117 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
| 118 | if (is_type_valid(i)) |
---|
| 119 | { |
---|
| 120 | std::string name = toString(static_cast<type_t>(i)).c_str(); |
---|
| 121 | // _stat->create_expr_average_by_cycle("average_inst_type_"+toString(name), "nb_inst_type_"+toString(i), "", toString(_("Average instruction retire ok by cycle (type %s)"),name.c_str())); |
---|
| 122 | _stat->create_expr_percent ("percent_inst_type_"+toString(name), "nb_inst_type_"+toString(i), sum_nb_inst_type, toString(_("Percent instruction retire ok by cycle (type %s)"),name.c_str())); |
---|
| 123 | } |
---|
| 124 | } |
---|
| 125 | |
---|
| 126 | |
---|
[88] | 127 | _stat_nb_inst_commit = _stat->create_variable("nb_inst_commit"); |
---|
| 128 | _stat->create_expr_average_by_cycle("average_use_interface_commit","nb_inst_commit", "", _("Average instruction by cycle on commit interface")); |
---|
| 129 | _stat->create_expr_percent ("percent_use_interface_commit", "average_use_interface_commit", toString(_param->_nb_inst_commit), _("Percent usage of commit interface")); |
---|
| 130 | |
---|
| 131 | _stat_nb_inst_commit_conflit_access = _stat->create_variable("nb_inst_commit_conflit_access"); |
---|
| 132 | _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")); |
---|
| 133 | _stat->create_expr_percent ("percent_use_interface_commit_conflit_access","average_use_interface_commit_conflit_access", "average_use_interface_commit", _("Percent access conflit on commit interface")); |
---|
| 134 | |
---|
| 135 | // bank/queue occupation |
---|
| 136 | { |
---|
| 137 | std::string sum_bank_nb_inst = ""; |
---|
| 138 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
| 139 | { |
---|
| 140 | _stat_bank_nb_inst [i] = _stat->create_variable("bank_nb_inst_"+toString(i)); |
---|
| 141 | |
---|
| 142 | _stat->create_expr_average_by_cycle("average_occupation_bank_"+toString(i), "bank_nb_inst_"+toString(i), "", toString(_("Average instruction by cycle (bank %d)"),i)); |
---|
| 143 | _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)); |
---|
| 144 | |
---|
| 145 | if (i == 0) |
---|
| 146 | sum_bank_nb_inst = "bank_nb_inst_"+toString(i); |
---|
| 147 | else |
---|
| 148 | sum_bank_nb_inst = "+ bank_nb_inst_"+toString(i) + " " +sum_bank_nb_inst; |
---|
| 149 | } |
---|
| 150 | |
---|
| 151 | _stat->create_expr_average_by_cycle("average_occupation_bank", sum_bank_nb_inst, "", _("Average instruction by cycle (all bank)")); |
---|
| 152 | _stat->create_expr_percent ("percent_occupation_bank" , "average_occupation_bank", toString(_param->_size_queue), _("Percent occupation of Re-Order-Buffer (all bank)")); |
---|
| 153 | } |
---|
| 154 | |
---|
| 155 | |
---|
| 156 | log_end(Commit_unit,FUNCTION); |
---|
| 157 | }; |
---|
| 158 | |
---|
| 159 | }; // end namespace commit_unit |
---|
| 160 | }; // end namespace ooo_engine |
---|
| 161 | }; // end namespace multi_ooo_engine |
---|
| 162 | }; // end namespace core |
---|
| 163 | |
---|
| 164 | }; // end namespace behavioural |
---|
| 165 | }; // end namespace morpheo |
---|
| 166 | #endif |
---|