RINASim
October 2016
Documentation of framework for OMNeT++
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
SM_Burst.cc
Go to the documentation of this file.
1
#include "
SM_Burst.h
"
2
3
namespace
ModularMonitor
{
4
5
SM_Burst::SM_Burst
() {
6
duration
= 0.0;
7
size
= 1500;
8
currentSize
= 0;
9
}
10
11
SM_Burst::SM_Burst
(simtime_t t,
unsigned
int
s) {
12
duration
= t;
13
size
= s;
14
currentSize
= 0;
15
}
16
17
void
SM_Burst::set
(simtime_t t,
unsigned
int
s) {
18
duration
= t;
19
size
= s;
20
}
21
22
void
SM_Burst::in
(
unsigned
int
s) {
23
pTimes
.push_back(simTime()+
duration
);
24
pSizes
.push_back(s);
25
currentSize
+= s;
26
}
27
28
void
SM_Burst::out
() {
29
simtime_t c = simTime();
30
31
while
(!
pTimes
.empty() && c >=
pTimes
.front()){
32
currentSize
-=
pSizes
.front();
33
pTimes
.pop_front();
34
pSizes
.pop_front();
35
}
36
37
}
38
39
double
SM_Burst::tic
() {
40
out
();
41
return
(
double
)
currentSize
/(double)
size
;
42
}
43
44
double
SM_Burst::tic
(
unsigned
int
s) {
45
out
();
46
return
(
double
)(
currentSize
+s)/(
double
)
size
;
47
}
48
49
simtime_t
SM_Burst::getTime
(
unsigned
int
s) {
50
unsigned
int
freeSize =
size
-
currentSize
;
51
52
auto
tIt =
pTimes
.begin();
53
auto
sIt =
pSizes
.begin();
54
55
while
(tIt !=
pTimes
.end() && sIt !=
pSizes
.end()) {
56
freeSize += *sIt;
57
58
if
(freeSize >= s) {
return
*tIt; }
59
60
tIt++;
61
sIt++;
62
}
63
64
return
0;
65
}
66
67
}
ModularMonitor
Definition:
ModularMonitor.cc:25
ModularMonitor::SM_Burst::getTime
simtime_t getTime(unsigned int)
Definition:
SM_Burst.cc:49
SM_Burst.h
ModularMonitor::SM_Burst::out
void out()
Definition:
SM_Burst.cc:28
ModularMonitor::SM_Burst::pTimes
list< simtime_t > pTimes
Definition:
SM_Burst.h:30
ModularMonitor::SM_Burst::pSizes
list< unsigned int > pSizes
Definition:
SM_Burst.h:29
ModularMonitor::SM_Burst::in
void in(unsigned int)
Definition:
SM_Burst.cc:22
ModularMonitor::SM_Burst::currentSize
unsigned int currentSize
Definition:
SM_Burst.h:28
ModularMonitor::SM_Burst::tic
double tic()
Definition:
SM_Burst.cc:39
ModularMonitor::SM_Burst::size
unsigned int size
Definition:
SM_Burst.h:26
ModularMonitor::SM_Burst::set
void set(simtime_t, unsigned int)
Definition:
SM_Burst.cc:17
ModularMonitor::SM_Burst::duration
simtime_t duration
Definition:
SM_Burst.h:25
ModularMonitor::SM_Burst::SM_Burst
SM_Burst()
Definition:
SM_Burst.cc:5
policies
DIF
RMT
Monitor
ModularMonitor
SM_Burst
SM_Burst.cc
Generated on Tue Oct 25 2016 21:08:55 for RINASim by
1.8.10