OverSim
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
GlobalStatistics.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2007 Institut fuer Telematik, Universitaet Karlsruhe (TH)
3
//
4
// This program is free software; you can redistribute it and/or
5
// modify it under the terms of the GNU General Public License
6
// as published by the Free Software Foundation; either version 2
7
// of the License, or (at your option) any later version.
8
//
9
// This program is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
// GNU General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with this program; if not, write to the Free Software
16
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
//
18
24
#ifndef __GLOBALSTATISTICS_H__
25
#define __GLOBALSTATISTICS_H__
26
27
#include <map>
28
29
#include <omnetpp.h>
30
31
class
OverlayKey
;
32
38
#define RECORD_STATS(x) \
39
do { \
40
if (globalStatistics->isMeasuring()){ x; } \
41
} while(false)
42
43
44
50
class
GlobalStatistics
:
public
cSimpleModule
51
{
52
public
:
53
static
const
double
MIN_MEASURED
;
54
55
double
sentKBRTestAppMessages
;
56
double
deliveredKBRTestAppMessages
;
57
int
testCount
;
58
cOutVector
currentDeliveryVector
;
59
63
~GlobalStatistics
();
64
72
void
addStdDev
(
const
std::string& name,
double
value);
73
78
void
recordHistogram
(
const
std::string& name,
double
value);
79
86
void
recordOutVector
(
const
std::string& name,
double
value);
87
88
void
startMeasuring
();
89
90
inline
bool
isMeasuring
() {
return
measuring
; };
91
inline
bool
getMeasureNetwInitPhase
() {
return
measureNetwInitPhase
; };
92
inline
simtime_t
getMeasureStartTime
() {
return
measureStartTime
; };
93
94
simtime_t
calcMeasuredLifetime
(simtime_t creationTime);
95
96
void
finalizeStatistics
();
97
98
protected
:
99
100
struct
OutVector
101
{
102
cOutVector
vector
;
103
int
count
;
104
double
value
;
105
double
avg
;
106
107
OutVector
(
const
std::string& name) :
108
vector
(name.c_str()),
count
(0),
value
(0),
avg
(0) {};
109
};
110
111
std::map<std::string, cStdDev*>
stdDevMap
;
112
std::map<std::string, cHistogram*>
histogramMap
;
113
std::map<std::string, OutVector*>
outVectorMap
;
114
cMessage*
globalStatTimer
;
115
double
globalStatTimerInterval
;
116
120
virtual
void
initialize
();
121
125
virtual
void
handleMessage
(cMessage* msg);
126
130
virtual
void
finish
();
131
132
bool
measuring
;
133
bool
measureNetwInitPhase
;
134
simtime_t
measureStartTime
;
135
};
136
137
#endif
src
common
GlobalStatistics.h
Generated on Fri Dec 7 2012 13:37:52 for OverSim by
1.8.1.2