36 sentKBRTestAppMessages = 0;
37 deliveredKBRTestAppMessages = 0;
39 measuring = measureNetwInitPhase = par(
"measureNetwInitPhase");
42 currentDeliveryVector.setName(
"Current Delivery Ratio");
45 globalStatTimerInterval = par(
"globalStatTimerInterval");
47 if (globalStatTimerInterval > 0) {
48 globalStatTimer =
new cMessage(
"globalStatTimer");
49 scheduleAt(simTime() + globalStatTimerInterval, globalStatTimer);
53 WATCH(measureStartTime);
54 WATCH(currentDeliveryVector);
61 measureStartTime = simTime();
68 if (msg == globalStatTimer) {
70 scheduleAt(simTime() + globalStatTimerInterval, msg);
75 if (sentKBRTestAppMessages == 0) {
78 ratio = (double)deliveredKBRTestAppMessages /
79 (
double)sentKBRTestAppMessages;
82 if (ratio > 1) ratio = 1;
84 currentDeliveryVector.record(ratio);
85 sentKBRTestAppMessages = 0;
86 deliveredKBRTestAppMessages = 0;
91 error(
"GlobalStatistics::handleMessage(): Unknown message type!");
100 cModuleType* moduleType = cModuleType::get(
"oversim.common.FinisherModule");
101 moduleType->create(
"finisherModule", getParentModule()->getParentModule());
107 recordScalar(
"GlobalStatistics: Simulation Time", simTime());
109 bool outputMinMax = par(
"outputMinMax");
110 bool outputStdDev = par(
"outputStdDev");
113 for (map<std::string, cStdDev*>::iterator iter = stdDevMap.begin();
114 iter != stdDevMap.end(); iter++) {
116 const std::string& n = iter->first;
117 const cStatistic& stat = *(iter->second);
119 recordScalar((n +
".mean").c_str(), stat.getMean());
122 recordScalar((n +
".stddev").c_str(), stat.getStddev());
125 recordScalar((n +
".min").c_str(), stat.getMin());
126 recordScalar((n +
".max").c_str(), stat.getMax());
130 for (map<std::string, cHistogram*>::iterator iter = histogramMap.begin();
131 iter != histogramMap.end(); iter++) {
132 const std::string& n = iter->first;
133 recordStatistic(n.c_str(), iter->second);
136 for (map<std::string, OutVector*>::iterator iter = outVectorMap.begin();
137 iter != outVectorMap.end(); iter++) {
140 recordScalar((
"Vector: " + iter->first +
".mean").c_str(), mean);
150 std::map<std::string, cStdDev*>::iterator sdPos = stdDevMap.find(name);
153 if (sdPos == stdDevMap.end()) {
154 Enter_Method_Silent();
155 sd =
new cStdDev(name.c_str());
156 stdDevMap.insert(pair<std::string, cStdDev*>(name, sd));
170 std::map<std::string, cHistogram*>::iterator hPos = histogramMap.find(name);
171 cHistogram* h = NULL;
173 if (hPos == histogramMap.end()) {
174 Enter_Method_Silent();
175 h =
new cHistogram(name.c_str());
176 histogramMap.insert(pair<std::string, cHistogram*>(name, h));
190 std::map<std::string, OutVector*>::iterator ovPos =
191 outVectorMap.find(name);
194 if (ovPos == outVectorMap.end()) {
195 Enter_Method_Silent();
197 outVectorMap.insert(pair<std::string, OutVector*>(name, ov));
209 return simTime() - ((creationTime > measureStartTime)
210 ? creationTime : measureStartTime);
216 for (map<std::string, cStdDev*>::iterator it = stdDevMap.begin();
217 it != stdDevMap.end(); it++) {
222 for (map<std::string, OutVector*>::iterator it = outVectorMap.begin();
223 it != outVectorMap.end(); it++) {
226 outVectorMap.clear();
228 for (map<std::string, cHistogram*>::iterator iter = histogramMap.begin();
229 iter != histogramMap.end(); iter++) {
232 histogramMap.clear();