1 | #ifdef STATISTICS |
---|
2 | /* |
---|
3 | * $Id: Commit_unit_statistics_allocation.cpp 137 2010-02-16 12:35:48Z 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_cycle_state_no_event = new counter_t * [_param->_nb_thread]; |
---|
30 | _stat_nb_cycle_state_not_yet_event = new counter_t * [_param->_nb_thread]; |
---|
31 | _stat_nb_cycle_state_event = new counter_t * [_param->_nb_thread]; |
---|
32 | _stat_nb_cycle_state_wait_end = new counter_t * [_param->_nb_thread]; |
---|
33 | |
---|
34 | { |
---|
35 | for (uint32_t i=0; i<_param->_nb_thread; i++) |
---|
36 | if (_param->_have_thread [i]) |
---|
37 | { |
---|
38 | _stat_nb_cycle_state_no_event [i] = _stat->create_variable("nb_cycle_state_no_event_" +toString(i)); |
---|
39 | _stat_nb_cycle_state_not_yet_event [i] = _stat->create_variable("nb_cycle_state_not_yet_event_"+toString(i)); |
---|
40 | _stat_nb_cycle_state_event [i] = _stat->create_variable("nb_cycle_state_event_" +toString(i)); |
---|
41 | _stat_nb_cycle_state_wait_end [i] = _stat->create_variable("nb_cycle_state_wait_end_" +toString(i)); |
---|
42 | |
---|
43 | _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)); |
---|
44 | _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)); |
---|
45 | _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)); |
---|
46 | _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)); |
---|
47 | } |
---|
48 | } |
---|
49 | |
---|
50 | _stat_nb_inst_insert = new counter_t * [_param->_nb_rename_unit]; |
---|
51 | _stat_nb_inst_retire = new counter_t * [_param->_nb_rename_unit]; |
---|
52 | _stat_nb_inst_retire_ok = new counter_t * [_param->_nb_thread]; |
---|
53 | _stat_nb_inst_retire_ko = new counter_t * [_param->_nb_thread]; |
---|
54 | _stat_nb_inst_instruction = new counter_t * [NB_INSTRUCTION]; |
---|
55 | _stat_nb_inst_type = new counter_t * [_param->_nb_type]; |
---|
56 | _stat_bank_nb_inst = new counter_t * [_param->_nb_bank]; |
---|
57 | |
---|
58 | { |
---|
59 | std::string sum_nb_inst_insert = "0"; |
---|
60 | std::string sum_nb_inst_retire = "0"; |
---|
61 | |
---|
62 | for (uint32_t i=0; i<_param->_nb_rename_unit; i++) |
---|
63 | { |
---|
64 | _stat_nb_inst_insert [i] = _stat->create_variable("nb_inst_insert_" +toString(i)); |
---|
65 | _stat_nb_inst_retire [i] = _stat->create_variable("nb_inst_retire_" +toString(i)); |
---|
66 | |
---|
67 | _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)); |
---|
68 | _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)); |
---|
69 | _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)); |
---|
70 | _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)); |
---|
71 | |
---|
72 | sum_nb_inst_insert = "+ nb_inst_insert_"+ toString(i) + " " +sum_nb_inst_insert; |
---|
73 | sum_nb_inst_retire = "+ nb_inst_retire_"+ toString(i) + " " +sum_nb_inst_retire; |
---|
74 | } |
---|
75 | |
---|
76 | _stat->create_expr_average_by_cycle("average_inst_insert" , sum_nb_inst_insert , "", _("Average instruction insert by cycle")); |
---|
77 | _stat->create_expr_average_by_cycle("average_inst_retire" , sum_nb_inst_retire , "", _("Average instruction retire by cycle")); |
---|
78 | } |
---|
79 | |
---|
80 | { |
---|
81 | std::string sum_nb_inst_retire_ok = "0"; |
---|
82 | std::string sum_nb_inst_retire_ko = "0"; |
---|
83 | std::string sum_average; |
---|
84 | for (uint32_t i=0; i<_param->_nb_thread; i++) |
---|
85 | if (_param->_have_thread [i]) |
---|
86 | { |
---|
87 | _stat_nb_inst_retire_ok [i] = _stat->create_variable("nb_inst_retire_ok_"+toString(i)); |
---|
88 | _stat_nb_inst_retire_ko [i] = _stat->create_variable("nb_inst_retire_ko_"+toString(i)); |
---|
89 | |
---|
90 | sum_nb_inst_retire_ok = "+ nb_inst_retire_ok_"+toString(i) + " " +sum_nb_inst_retire_ok; |
---|
91 | sum_nb_inst_retire_ko = "+ nb_inst_retire_ko_"+toString(i) + " " +sum_nb_inst_retire_ko; |
---|
92 | sum_average = "+ average_inst_retire_ok_"+toString(i)+" average_inst_retire_ko_"+toString(i); |
---|
93 | |
---|
94 | _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)); |
---|
95 | _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)); |
---|
96 | |
---|
97 | _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)); |
---|
98 | _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)); |
---|
99 | |
---|
100 | _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)); |
---|
101 | _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)); |
---|
102 | |
---|
103 | _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)); |
---|
104 | _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)); |
---|
105 | |
---|
106 | _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)); |
---|
107 | _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)); |
---|
108 | } |
---|
109 | |
---|
110 | _stat->create_expr_average_by_cycle("average_inst_retire_ok", sum_nb_inst_retire_ok, "", _("Average instruction retire ok by cycle (all thread)")); |
---|
111 | _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)")); |
---|
112 | |
---|
113 | sum_average = "+ average_inst_retire_ok average_inst_retire_ko"; |
---|
114 | |
---|
115 | _stat->create_expr_percent ("percent_inst_retire_ok","average_inst_retire_ok", sum_average, _("Percent instruction retire ok by cycle (all thread)")); |
---|
116 | _stat->create_expr_percent ("percent_inst_retire_ko","average_inst_retire_ko", sum_average, _("Percent instruction retire ko by cycle (all thread)")); |
---|
117 | |
---|
118 | _stat->create_expr ("IPC_ok" , "/ "+sum_nb_inst_retire_ok+" cycle", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ok)"); |
---|
119 | _stat->create_expr ("CPI_ok" , "/ 1 IPC_ok" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ok)"); |
---|
120 | |
---|
121 | _stat->create_expr ("IPC_ko" , "/ "+sum_nb_inst_retire_ko+" cycle", TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ko)"); |
---|
122 | _stat->create_expr ("CPI_ko" , "/ 1 IPC_ko" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ko)"); |
---|
123 | |
---|
124 | _stat->create_expr ("IPC_all", "+ IPC_ok IPC_ko" , TYPE_COUNTER, "inst/cycle", "Instruction Per Cycle (Instruction Ok and Ko)"); |
---|
125 | _stat->create_expr ("CPI_all", "/ 1 IPC_all" , TYPE_COUNTER, "cycle/inst", "Cycle Per Instruction (Instruction Ok and Ko)"); |
---|
126 | } |
---|
127 | |
---|
128 | { |
---|
129 | std::string sum_nb_inst_type = "0"; |
---|
130 | |
---|
131 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
132 | if (is_type_valid(i)) |
---|
133 | { |
---|
134 | _stat_nb_inst_type [i] = _stat->create_variable("nb_inst_type_"+toString(i)); |
---|
135 | |
---|
136 | sum_nb_inst_type = "+ nb_inst_type_"+toString(i) + " " +sum_nb_inst_type; |
---|
137 | } |
---|
138 | |
---|
139 | for (uint32_t i=0; i<_param->_nb_type; i++) |
---|
140 | if (is_type_valid(i)) |
---|
141 | { |
---|
142 | std::string name = toString(static_cast<type_t>(i)); |
---|
143 | |
---|
144 | _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())); |
---|
145 | } |
---|
146 | } |
---|
147 | |
---|
148 | { |
---|
149 | std::string sum_nb_inst_instruction = "0"; |
---|
150 | |
---|
151 | for (uint32_t i=0; i<NB_INSTRUCTION; i++) |
---|
152 | { |
---|
153 | _stat_nb_inst_instruction [i] = _stat->create_variable("nb_inst_instruction_"+toString(i)); |
---|
154 | |
---|
155 | sum_nb_inst_instruction = "+ nb_inst_instruction_"+toString(i) + " " +sum_nb_inst_instruction; |
---|
156 | } |
---|
157 | |
---|
158 | for (uint32_t i=0; i<NB_INSTRUCTION; i++) |
---|
159 | { |
---|
160 | std::string name = toString_instruction(i).c_str(); |
---|
161 | |
---|
162 | _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())); |
---|
163 | } |
---|
164 | } |
---|
165 | |
---|
166 | _stat_nb_inst_commit = _stat->create_variable("nb_inst_commit"); |
---|
167 | _stat->create_expr_average_by_cycle("average_use_interface_commit","nb_inst_commit", "", _("Average instruction by cycle on commit interface")); |
---|
168 | _stat->create_expr_percent ("percent_use_interface_commit", "average_use_interface_commit", toString(_param->_nb_inst_commit), _("Percent usage of commit interface")); |
---|
169 | |
---|
170 | _stat_nb_inst_commit_conflit_access = _stat->create_variable("nb_inst_commit_conflit_access"); |
---|
171 | _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")); |
---|
172 | _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")); |
---|
173 | |
---|
174 | // bank/queue occupation |
---|
175 | { |
---|
176 | std::string sum_bank_nb_inst = ""; |
---|
177 | for (uint32_t i=0; i<_param->_nb_bank; i++) |
---|
178 | { |
---|
179 | _stat_bank_nb_inst [i] = _stat->create_variable("bank_nb_inst_"+toString(i)); |
---|
180 | |
---|
181 | _stat->create_expr_average_by_cycle("average_occupation_bank_"+toString(i), "bank_nb_inst_"+toString(i), "", toString(_("Average instruction by cycle (bank %d)"),i)); |
---|
182 | _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)); |
---|
183 | |
---|
184 | if (i == 0) |
---|
185 | sum_bank_nb_inst = "bank_nb_inst_"+toString(i); |
---|
186 | else |
---|
187 | sum_bank_nb_inst = "+ bank_nb_inst_"+toString(i) + " " +sum_bank_nb_inst; |
---|
188 | } |
---|
189 | |
---|
190 | _stat->create_expr_average_by_cycle("average_occupation_bank", sum_bank_nb_inst, "", _("Average instruction by cycle (all bank)")); |
---|
191 | _stat->create_expr_percent ("percent_occupation_bank" , "average_occupation_bank", toString(_param->_size_queue), _("Percent occupation of Re-Order-Buffer (all bank)")); |
---|
192 | } |
---|
193 | |
---|
194 | |
---|
195 | log_end(Commit_unit,FUNCTION); |
---|
196 | }; |
---|
197 | |
---|
198 | }; // end namespace commit_unit |
---|
199 | }; // end namespace ooo_engine |
---|
200 | }; // end namespace multi_ooo_engine |
---|
201 | }; // end namespace core |
---|
202 | |
---|
203 | }; // end namespace behavioural |
---|
204 | }; // end namespace morpheo |
---|
205 | #endif |
---|