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

Last change on this file since 124 was 124, checked in by rosiere, 15 years ago

1) Add test and configuration
2) Fix Bug
3) Add log file in load store unit
4) Fix Bug in environment

  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 2.0 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    _list_operand  = new std::map<std::string, var_t>;
17    _list_expr     = new std::list<expr_t>;
18    _list_stat     = new std::list<Stat *>;
19
20    _cycle         = create_variable("cycle");
21//  _cycle         = create_counter("cycle","","");
22    *_cycle        = 0; // for the first period
23
24    _generate_file = true;
25  }
26
27  Stat::Stat (std::string name_instance,
28              std::string name_component,
29              cycle_t nb_cycle_before_begin,
30              cycle_t period):
31    _name_instance         (name_instance),
32    _name_component        (name_component),
33    _nb_cycle_before_begin (nb_cycle_before_begin),
34    _period                (period),
35    _save_periodic         (period>0)
36  {
37    _list_operand  = new std::map<std::string, var_t>;
38    _list_expr     = new std::list<expr_t>;
39    _list_stat     = new std::list<Stat *>;
40
41    _cycle         = create_variable("cycle");
42//  _cycle         = create_counter("cycle","","");
43    *_cycle        = 0; // for the first period
44
45    _generate_file = true;
46  }
47
48  Stat::~Stat (void)
49  {
50    if (_generate_file)
51      generate_file();
52
53    // parcourir la liste et desallouer les counters
54    for (std::map<std::string, var_t>::iterator i=_list_operand->begin();
55         i!= _list_operand->end();
56         ++i)
57      {
58        delete i->second.counter;
59      }
60    delete _list_operand;
61
62    // parcourir la liste et desallouer les arbres
63    for (std::list<expr_t>::iterator i=_list_expr->begin();
64         i!= _list_expr->end();
65         ++i)
66      {
67        delete i->expression;
68      }
69    delete _list_expr;
70    delete _list_stat;
71  }
72};
73};
74#endif
Note: See TracBrowser for help on using the repository browser.