source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_print.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: 2.1 KB
Line 
1#ifdef STATISTICS
2#include "Behavioural/include/Stat.h"
3
4namespace morpheo {
5namespace behavioural { 
6
7  std::string Stat::print (uint32_t depth)
8  {
9    end_simulation(); 
10
11    cycle_t _cycle_sum = sc_simulation_time();
12
13    morpheo::behavioural::XML xml (_name_instance);
14
15    xml.balise_open_begin(_name_component);
16    xml.attribut("name",_name_instance);
17    xml.balise_open_end();
18
19    // Print component
20    for (std::list<Stat *>::iterator stat=_list_stat->begin();
21         stat != _list_stat->end();
22         stat ++)
23      xml.text((*stat)->print(depth+1));
24   
25
26    // Test special case
27    if (_cycle_sum < _nb_cycle_before_begin)
28      {
29        xml.comment(_("Number of cycle is less than the number minimal"));
30      }
31    else
32      {
33        bool stop = false;
34        cycle_t nb_cycle_min;
35        cycle_t nb_cycle_max = _nb_cycle_before_begin-1;
36        for (cycle_t period=0; stop==false; period++)
37          {
38            std::map<std::string, var_t>::iterator operand=_list_operand->begin();
39
40            if (operand->second.save_counter.size()==0)
41              throw(ERRORMORPHEO("Stat::generate_file",_("Queue 'save_counter' is empty.")));
42
43            bool last = operand->second.save_counter.size()==1;
44
45            nb_cycle_min  = nb_cycle_max+1;
46
47            if (last)
48              nb_cycle_max = static_cast<cycle_t>(_cycle_sum);
49            else
50              nb_cycle_max += _period;
51
52            xml.balise_open_begin("period");
53            xml.attribut("number",toString(period));
54            xml.attribut("nb_cycle_min",toString(nb_cycle_min));
55            xml.attribut("nb_cycle_max",toString(nb_cycle_max));
56            xml.balise_open_end();
57           
58            for (;
59                 operand!= _list_operand->end();
60                 ++operand)
61              {
62                if (operand->second.type == TYPE_COUNTER)
63                  {
64                    xml.singleton_begin(operand->second.name);
65                    xml.attribut("value",toString(operand->second.save_counter.front()));
66                    xml.attribut("unit",operand->second.unit);
67                    xml.attribut("description",operand->second.description);
68                    xml.singleton_end();
69                  }
70                operand->second.save_counter.pop_front();
71              }
72
73            xml.balise_close();
74           
75            stop = last;
76          }
77      }
78    xml.balise_close();
79
80    return xml.get_body(depth);
81  }
82}; 
83};
84#endif
Note: See TracBrowser for help on using the repository browser.