source: trunk/IPs/systemC/processor/Morpheo/Behavioural/Core/Multi_Front_end/Front_end/Prediction_unit/Update_Prediction_Table/src/Update_Prediction_Table_statistics_allocation.cpp @ 97

Last change on this file since 97 was 97, checked in by rosiere, 16 years ago

1) Update Prediction Table : statistics
2) Size instruction address on 30 bits
3) Change Log File
4) Add debug_level in simulation configuration file

  • Property svn:keywords set to Id
File size: 5.7 KB
Line 
1#ifdef STATISTICS
2/*
3 * $Id: Update_Prediction_Table_statistics_allocation.cpp 97 2008-12-19 15:34:00Z 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
13namespace morpheo {
14namespace behavioural {
15namespace core {
16namespace multi_front_end {
17namespace front_end {
18namespace prediction_unit {
19namespace 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      for (uint32_t i=0; i<_param->_nb_context; ++i)
38        {
39          std::string sum_miss        = "0";
40          std::string sum_branchement = "0";
41
42          for (uint32_t j=0; j<MAX_BRANCH_CONDITION; ++j)
43            if (is_branch_condition_valid(j))
44              {
45                std::string nb_miss        = "nb_branch_miss_"+toString(i)+"_"+toString(j); 
46                std::string nb_branchement = "+ nb_branch_hit_"+toString(i)+"_"+toString(j)+" nb_branch_miss_"+toString(i)+"_"+toString(j);
47                _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));
48                _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));
49
50//                 _stat->create_expr_average("average_miss_"+toString(i)+"_"+toString(j),
51//                                            "nb_branch_miss_"+toString(i)+"_"+toString(j),
52//                                            nb_branchement,
53//                                            "miss/branchement",
54//                                            toString(_("Average miss by branchement, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i));
55
56                _stat->create_expr_percent("percent_miss_"+toString(i)+"_"+toString(j),
57                                           nb_miss,
58                                           nb_branchement,
59                                           toString(_("Percent miss by branchement, branch condition : %s (context %d)"),toString(static_cast<branch_condition_t>(j)).c_str(),i));
60
61                sum_miss        = "+ "+nb_miss       +" "+ sum_miss;
62                sum_branchement = "+ "+nb_branchement+" "+sum_branchement;
63              }
64
65//           _stat->create_expr_average("average_miss_"+toString(i),
66//                                      sum_miss,
67//                                      sum_branchement,
68//                                      "miss/branchement",
69//                                      toString(_("Average miss by branchement (context %d)"),i));
70
71          _stat->create_expr_percent("percent_miss_"+toString(i),
72                                     sum_miss,
73                                     sum_branchement,
74                                     toString(_("Percent miss by branchement (context %d)"),i));
75         
76          _stat_nb_branch_unused [i] = _stat->create_counter("nb_branch_unused_" +toString(i),"",toString(_("Branch unused (previous speculation) (context %d)"),i));
77        }
78    }
79
80    {
81      ALLOC1(_stat_ufpt_queue_nb_elt        ,counter_t *,_param->_nb_context);
82     
83      for (uint32_t i=0; i<_param->_nb_context; ++i)
84        {
85          _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));
86         
87          _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));
88          _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));
89        }
90    }
91
92    {
93      ALLOC1(_stat_upt_queue_nb_elt        ,counter_t *,_param->_nb_context);
94     
95      for (uint32_t i=0; i<_param->_nb_context; ++i)
96        {
97          _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));
98         
99          _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));
100          _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));
101        }
102    }
103
104    log_printf(FUNC,Update_Prediction_Table,FUNCTION,"End");
105  };
106
107}; // end namespace update_prediction_table
108}; // end namespace prediction_unit
109}; // end namespace front_end
110}; // end namespace multi_front_end
111}; // end namespace core
112
113}; // end namespace behavioural
114}; // end namespace morpheo             
115#endif
Note: See TracBrowser for help on using the repository browser.