source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat.cpp @ 138

Last change on this file since 138 was 138, checked in by rosiere, 14 years ago

1) add counters_t type for interface
2) fix in check load in load_store_unit
3) add parameters (but not yet implemented)
4) change environment and add script (distcc_env.sh ...)
5) add warning if an unser change rename flag with l.mtspr instruction
6) ...

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.3 KB
Line 
1#ifdef STATISTICS
2#include "Behavioural/include/Stat.h"
3
4namespace morpheo {
5namespace behavioural {
6
7  Stat::Stat (std::string name_instance,
8              std::string name_component,
9              Parameters_Statistics * param):
10    _name_instance         (name_instance),
11    _name_component        (name_component),
12    _nb_cycle_before_begin (static_cast<cycle_t>(param->_nb_cycle_before_begin)),
13    _period                (static_cast<cycle_t>(param->_period_save)),
14    _save_periodic         (_period>0)
15  {
16    _generate_file = true;
17
18    _list_operand  = new std::map<std::string, var_t>;
19    _list_expr     = new std::list<expr_t>;
20    _list_stat     = new std::list<Stat *>;
21    _list_counters = new std::list<counters_t *>;
22
23    _cycle         = create_variable("cycle");
24//  _cycle         = create_counter("cycle","","");
25    *_cycle        = 0; // for the first period
26  }
27
28  Stat::Stat (std::string name_instance,
29              std::string name_component,
30              cycle_t nb_cycle_before_begin,
31              cycle_t period):
32    _name_instance         (name_instance),
33    _name_component        (name_component),
34    _nb_cycle_before_begin (nb_cycle_before_begin),
35    _period                (period),
36    _save_periodic         (period>0)
37  {
38    _generate_file = true;
39
40    _list_operand  = new std::map<std::string, var_t>;
41    _list_expr     = new std::list<expr_t>;
42    _list_stat     = new std::list<Stat *>;
43    _list_counters = new std::list<counters_t *>;
44
45    _cycle         = create_variable("cycle");
46//  _cycle         = create_counter("cycle","","");
47    *_cycle        = 0; // for the first period
48  }
49
50  Stat::~Stat (void)
51  {
52    if (_generate_file)
53      generate_file();
54
55    // parcourir la liste et desallouer les counters
56    for (std::map<std::string, var_t>::iterator i=_list_operand->begin();
57         i!= _list_operand->end();
58         ++i)
59      {
60        delete i->second.counter;
61      }
62    delete _list_operand;
63
64    // parcourir la liste et desallouer les arbres
65    for (std::list<expr_t>::iterator i=_list_expr->begin();
66         i!= _list_expr->end();
67         ++i)
68      {
69        delete i->expression;
70      }
71    delete _list_expr;
72
73    // parcourir la liste et desallouer les arbres
74    for (std::list<counters_t*>::iterator i=_list_counters->begin();
75         i!= _list_counters->end();
76         ++i)
77      {
78        delete *i;
79      }
80    delete _list_counters;
81
82    delete _list_stat;
83  }
84};
85};
86#endif
Note: See TracBrowser for help on using the repository browser.