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

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

New component : Read_unit (instance between a write queue and a optionnal execute_queue)

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