source: trunk/IPs/systemC/processor/Morpheo/Behavioural/src/Stat_create_expr.cpp @ 146

Last change on this file since 146 was 139, checked in by rosiere, 14 years ago
  • Add test for all configuration
  • RAT : add rat scheme (depth_save)
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.9 KB
Line 
1#ifdef STATISTICS
2#include "Behavioural/include/Stat.h"
3
4namespace morpheo {
5namespace behavioural {
6
7#undef  FUNCTION
8#define FUNCTION "Stat::create_expr"
9  void Stat::create_expr (std::string varname,
10                          std::string expr,
11                          bool each_cycle)
12  {
13    if (is_valid_var (varname))
14      throw(ERRORMORPHEO(FUNCTION,toString(_("<%s> Variable \"%s\" is not valid."),_name_instance.c_str(),varname.c_str())));
15   
16    expr_t expression;
17
18    expression.variable   = (*_list_operand) [varname].counter;
19    expression.expression = string2tree(expr);
20//  expression.each_cycle = each_cycle;
21
22    if (each_cycle)
23      _list_expr_per_cycle ->push_back(expression);
24    else
25      _list_expr_per_period->push_back(expression);
26  }
27
28  void Stat::create_expr (std::string    varname,
29                          std::string    expr,
30                          counter_type_t type,
31                          std::string    unit,
32                          std::string    description,
33                          bool           each_cycle)
34  {
35    if (type == TYPE_COUNTER)
36      create_counter (varname,unit,description);
37    else
38      create_variable(varname);
39
40    create_expr(varname, expr, each_cycle);
41  }
42
43
44  void Stat::create_expr_average (std::string varname,
45                                  std::string expr_sum,
46                                  std::string expr_deps,
47                                  std::string unit,
48                                  std::string description)
49  {
50    create_counter(varname,unit,description);
51    create_expr   (varname, "/ "+expr_sum+" "+expr_deps, false);
52  }
53
54  void Stat::create_expr_average_by_cycle (std::string varname,
55                                           std::string expr_sum,
56                                           std::string unit,
57                                           std::string description)
58  {
59    create_expr_average (varname, expr_sum, "cycle", unit, description);
60  }
61
62  void Stat::create_expr_percent (std::string varname,
63                                  std::string expr_sum,
64                                  std::string expr_max,
65                                  std::string description)
66  {
67    create_counter(varname,"%",description);
68    create_expr   (varname, "/ * "+expr_sum+" 100 "+expr_max, false);
69  }
70
71
72};
73};
74#endif
Note: See TracBrowser for help on using the repository browser.