#include <Sink.h>
Protected Member Functions | |
| virtual void | initialize () |
| virtual void | handleMessage (cMessage *msg) |
| virtual void | finish () |
Protected Attributes | |
| int | numPackets |
| long | numBits |
| double | throughput |
| double | packetPerSec |
A module that just deletes every packet it receives, and collects basic statistics (packet count, bit count, packet rate, bit rate).
Definition at line 27 of file Sink.h.
| void Sink::finish | ( | ) | [protected, virtual] |
Definition at line 48 of file Sink.cc.
{
recordScalar("numPackets", numPackets);
recordScalar("numBits", numBits);
recordScalar("throughput", throughput);
recordScalar("packetPerSec", packetPerSec);
}
| void Sink::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Definition at line 37 of file Sink.cc.
{
numPackets++;
numBits += PK(msg)->getBitLength();
throughput = numBits / simTime();
packetPerSec = numPackets / simTime();
delete msg;
}
| void Sink::initialize | ( | ) | [protected, virtual] |
Definition at line 24 of file Sink.cc.
{
numPackets = 0;
numBits = 0;
throughput = 0;
packetPerSec = 0;
WATCH(numPackets);
WATCH(numBits);
WATCH(throughput);
WATCH(packetPerSec);
}
long Sink::numBits [protected] |
Definition at line 31 of file Sink.h.
Referenced by finish(), handleMessage(), and initialize().
int Sink::numPackets [protected] |
Definition at line 30 of file Sink.h.
Referenced by finish(), handleMessage(), and initialize().
double Sink::packetPerSec [protected] |
Definition at line 33 of file Sink.h.
Referenced by finish(), handleMessage(), and initialize().
double Sink::throughput [protected] |
Definition at line 32 of file Sink.h.
Referenced by finish(), handleMessage(), and initialize().
1.7.1