Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
bea13523
Commit
bea13523
authored
Aug 25, 2006
by
Jonathon Duerig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Whoops! The ewma sensor itself.
parent
7877d27a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
0 deletions
+63
-0
pelab/magent/EwmaThroughputSensor.cc
pelab/magent/EwmaThroughputSensor.cc
+41
-0
pelab/magent/EwmaThroughputSensor.h
pelab/magent/EwmaThroughputSensor.h
+22
-0
No files found.
pelab/magent/EwmaThroughputSensor.cc
0 → 100644
View file @
bea13523
// EwmaThroughputSensor.cc
#include "lib.h"
#include "EwmaThroughputSensor.h"
#include "ThroughputSensor.h"
#include "CommandOutput.h"
using
namespace
std
;
EwmaThroughputSensor
::
EwmaThroughputSensor
(
ThroughputSensor
*
newThroughputSource
)
:
throughput
(
0.0
)
,
throughputSource
(
newThroughputSource
)
{
}
void
EwmaThroughputSensor
::
localSend
(
PacketInfo
*
packet
)
{
}
void
EwmaThroughputSensor
::
localAck
(
PacketInfo
*
packet
)
{
int
latest
=
throughputSource
->
getThroughputInKbps
();
if
(
latest
!=
0
)
{
if
(
throughput
==
0.0
)
{
throughput
=
latest
;
}
else
{
static
const
double
alpha
=
0.1
;
throughput
=
throughput
*
(
1.0
-
alpha
)
+
latest
*
alpha
;
}
ostringstream
buffer
;
buffer
<<
setiosflags
(
ios
::
fixed
|
ios
::
showpoint
)
<<
setprecision
(
0
);
buffer
<<
"bandwidth="
<<
throughput
;
global
::
output
->
eventMessage
(
buffer
.
str
(),
packet
->
elab
,
CommandOutput
::
FORWARD_PATH
);
}
}
pelab/magent/EwmaThroughputSensor.h
0 → 100644
View file @
bea13523
// EwmaThroughputSensor.h
#ifndef EWMA_THROUGHPUT_SENSOR_H_STUB_2
#define EWMA_THROUGHPUT_SENSOR_H_STUB_2
#include "Sensor.h"
class
ThroughputSensor
;
class
EwmaThroughputSensor
:
public
Sensor
{
public:
EwmaThroughputSensor
(
ThroughputSensor
*
newThroughputSource
);
protected:
virtual
void
localSend
(
PacketInfo
*
packet
);
virtual
void
localAck
(
PacketInfo
*
packet
);
private:
double
throughput
;
ThroughputSensor
*
throughputSource
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment