-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatistics.H
More file actions
120 lines (81 loc) · 2.15 KB
/
Copy pathstatistics.H
File metadata and controls
120 lines (81 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# ifndef STATISTICS_H
# define STATISTICS_H
# include <statistics_per_element.H>
# include <cstdio>
# include <package.H>
class Package;
# ifndef MAX(a, b)
# define MAX(a, b) (a > b ? a : b)
# endif
class Statistics
{
public:
struct Pair_Of_List
{
DynDlist<Statistics_Per_Element> statistics_per_package;
DynDlist<Statistics_Per_Element> statistics_per_node;
};
private:
static Statistics * instance;
unsigned long num_iterations;
unsigned long generated_packages;
unsigned long deliveried_packages;
unsigned long package_in_queue;
unsigned long * deflections_counter;
unsigned long max_deflections;
double ttl_avg;
double tiq_avg;
DynDlist<Pair_Of_List> events_list_per_iteration;
Statistics();
public:
Statistics_Per_Element * search_package_statistic(const std::string &);
Statistics_Per_Element * search_node_statistic(const std::string &);
~Statistics();
DynDlist<Pair_Of_List> & get_events_list_per_iteration() { return events_list_per_iteration; }
const unsigned long & get_num_iterations() const
{
return num_iterations;
}
const unsigned long & get_generated_packages() const
{
return generated_packages;
}
const unsigned long & get_deliveried_packages() const
{
return deliveried_packages;
}
const unsigned long & get_num_packages_in_queue() const
{
return package_in_queue;
}
const double & get_ttl_avg() const
{
return ttl_avg;
}
const double & get_tiq_avg() const
{
return tiq_avg;
}
unsigned long * get_deflections_counter()
{
return deflections_counter;
}
const unsigned long & get_max_deflections() const
{
return max_deflections;
}
static Statistics * get_instance();
void inc_iterations();
void inc_generated_packages();
void inc_deliveried_packages();
void inc_packages_in_queue();
void dec_packages_in_queue();
void set_max_deflections(const unsigned long &);
void add_statistic_to_node(std::string &, std::string &);
void add_statistic_to_package(std::string &, std::string &);
void print();
void clear();
void init();
void count_deflections(DynDlist<Package> &);
};
#endif // STATISTICS_H