1 | #ifdef STATISTICS |
---|
2 | /* |
---|
3 | * $Id: Update_Prediction_Table_statistics_allocation.cpp 115 2009-04-20 21:29:17Z rosiere $ |
---|
4 | * |
---|
5 | * [ Description ] |
---|
6 | * |
---|
7 | */ |
---|
8 | |
---|
9 | #include "Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/include/Update_Prediction_Table.h" |
---|
10 | #include "Behavioural/include/Allocation.h" |
---|
11 | |
---|
12 | |
---|
13 | namespace morpheo { |
---|
14 | namespace behavioural { |
---|
15 | namespace core { |
---|
16 | namespace multi_front_end { |
---|
17 | namespace front_end { |
---|
18 | namespace prediction_unit { |
---|
19 | namespace update_prediction_table { |
---|
20 | |
---|
21 | |
---|
22 | #undef FUNCTION |
---|
23 | #define FUNCTION "Update_Prediction_Table::statistics_allocation" |
---|
24 | void Update_Prediction_Table::statistics_allocation (morpheo::behavioural::Parameters_Statistics * param_statistics) |
---|
25 | { |
---|
26 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"Begin"); |
---|
27 | |
---|
28 | _stat = new Stat (static_cast<std::string>(_name), |
---|
29 | "Update_Prediction_Table", |
---|
30 | param_statistics); |
---|
31 | |
---|
32 | { |
---|
33 | ALLOC2(_stat_nb_branch_hit ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION); |
---|
34 | ALLOC2(_stat_nb_branch_miss ,counter_t *,_param->_nb_context,MAX_BRANCH_CONDITION); |
---|
35 | ALLOC1(_stat_nb_branch_unused ,counter_t *,_param->_nb_context); |
---|
36 | |
---|
37 | ALLOC1(_stat_nb_branch_ifetch_prediction,counter_t *,_param->_nb_context); |
---|
38 | ALLOC1(_stat_nb_branch_accurate ,counter_t *,_param->_nb_context); |
---|
39 | |
---|
40 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
41 | { |
---|
42 | std::string sum_miss = "0"; |
---|
43 | std::string sum_branchement = "0"; |
---|
44 | |
---|
45 | for (uint32_t j=0; j<MAX_BRANCH_CONDITION; ++j) |
---|
46 | if (is_branch_condition_valid(j)) |
---|
47 | { |
---|
48 | std::string nb_miss = "nb_branch_miss_"+toString(i)+"_"+toString(j); |
---|
49 | std::string nb_branchement = "+ nb_branch_hit_"+toString(i)+"_"+toString(j)+" nb_branch_miss_"+toString(i)+"_"+toString(j); |
---|
50 | _stat_nb_branch_hit [i][j] = _stat->create_counter("nb_branch_hit_" +toString(i)+"_"+toString(j),"",toString(_("Branch hit speculation, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i)); |
---|
51 | _stat_nb_branch_miss [i][j] = _stat->create_counter(nb_miss,"",toString(_("Branch miss speculation, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i)); |
---|
52 | |
---|
53 | // _stat->create_expr_average("average_miss_"+toString(i)+"_"+toString(j), |
---|
54 | // "nb_branch_miss_"+toString(i)+"_"+toString(j), |
---|
55 | // nb_branchement, |
---|
56 | // "miss/branchement", |
---|
57 | // toString(_("Average miss by branchement, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i)); |
---|
58 | |
---|
59 | _stat->create_expr_percent("percent_miss_"+toString(i)+"_"+toString(j), |
---|
60 | nb_miss, |
---|
61 | nb_branchement, |
---|
62 | toString(_("Percent miss by branchement, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i)); |
---|
63 | |
---|
64 | sum_miss = "+ "+nb_miss +" "+ sum_miss; |
---|
65 | sum_branchement = "+ "+nb_branchement+" "+sum_branchement; |
---|
66 | } |
---|
67 | |
---|
68 | // _stat->create_expr_average("average_miss_"+toString(i), |
---|
69 | // sum_miss, |
---|
70 | // sum_branchement, |
---|
71 | // "miss/branchement", |
---|
72 | // toString(_("Average miss by branchement (context %d)"),i)); |
---|
73 | |
---|
74 | _stat->create_expr_percent("percent_miss_"+toString(i), |
---|
75 | sum_miss, |
---|
76 | sum_branchement, |
---|
77 | toString(_("Percent miss by branchement (context %d)"),i)); |
---|
78 | |
---|
79 | _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i)); |
---|
80 | _stat_nb_branch_ifetch_prediction [i] = _stat->create_counter("nb_branch_ifetch_prediction_"+toString(i),"",toString(_("Branch used and ifetch prediction (context %d)"),i)); |
---|
81 | _stat_nb_branch_accurate [i] = _stat->create_counter("nb_branch_accurate_" +toString(i),"",toString(_("Branch and is accurate (context %d)"),i)); |
---|
82 | |
---|
83 | _stat->create_expr("nb_branch_used_"+toString(i),sum_branchement,TYPE_COUNTER,"",_("Branch used")); |
---|
84 | } |
---|
85 | } |
---|
86 | |
---|
87 | { |
---|
88 | ALLOC1(_stat_ufpt_queue_nb_elt ,counter_t *,_param->_nb_context); |
---|
89 | |
---|
90 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
91 | { |
---|
92 | _stat_ufpt_queue_nb_elt [i] = _stat->create_counter("ufpt_queue_nb_elt_"+toString(i),"",toString(_("Branchement in Update Fetch Prediction Table (context %d)"),i)); |
---|
93 | |
---|
94 | _stat->create_expr_average_by_cycle("average_occupation_ufpt_queue_"+toString(i),"ufpt_queue_nb_elt_"+toString(i), "", toString(_("Average instruction by cycle in Update Fetch Prediction Table (context %d)"),i)); |
---|
95 | _stat->create_expr_percent ("percent_occupation_ufpt_queue_"+toString(i), "average_occupation_ufpt_queue_"+toString(i), toString(_param->_size_ufpt_queue[i]), toString(_("Percent occupation of Update Fetch Prediction Table (context %d)"),i)); |
---|
96 | } |
---|
97 | } |
---|
98 | |
---|
99 | { |
---|
100 | ALLOC1(_stat_upt_queue_nb_elt ,counter_t *,_param->_nb_context); |
---|
101 | |
---|
102 | for (uint32_t i=0; i<_param->_nb_context; ++i) |
---|
103 | { |
---|
104 | _stat_upt_queue_nb_elt [i] = _stat->create_counter("upt_queue_nb_elt_"+toString(i),"",toString(_("Average branchement by cycle in Update Prediction Table (context %d)"),i)); |
---|
105 | |
---|
106 | _stat->create_expr_average_by_cycle("average_occupation_upt_queue_"+toString(i),"upt_queue_nb_elt_"+toString(i), "", toString(_("Average instruction by cycle in Update Prediction Table (context %d)"),i)); |
---|
107 | _stat->create_expr_percent ("percent_occupation_upt_queue_"+toString(i), "average_occupation_upt_queue_"+toString(i), toString(_param->_size_upt_queue[i]), toString(_("Percent occupation of Update Prediction Table (context %d)"),i)); |
---|
108 | } |
---|
109 | } |
---|
110 | |
---|
111 | log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End"); |
---|
112 | }; |
---|
113 | |
---|
114 | }; // end namespace update_prediction_table |
---|
115 | }; // end namespace prediction_unit |
---|
116 | }; // end namespace front_end |
---|
117 | }; // end namespace multi_front_end |
---|
118 | }; // end namespace core |
---|
119 | |
---|
120 | }; // end namespace behavioural |
---|
121 | }; // end namespace morpheo |
---|
122 | #endif |
---|