INET Framework for OMNeT++/OMNEST
inet::Sink Class Reference

A module that just deletes every packet it receives, and collects basic statistics (packet count, bit count, packet rate, bit rate). More...

#include <Sink.h>

Inheritance diagram for inet::Sink:

Protected Member Functions

virtual void initialize () override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void finish () override
 

Protected Attributes

int numPackets
 
long numBits
 
double throughput
 
double packetPerSec
 

Static Protected Attributes

static simsignal_t rcvdPkSignal = registerSignal("rcvdPk")
 

Detailed Description

A module that just deletes every packet it receives, and collects basic statistics (packet count, bit count, packet rate, bit rate).

Member Function Documentation

void inet::Sink::finish ( )
overrideprotectedvirtual
52 {
53  recordScalar("throughput", throughput);
54  recordScalar("packetPerSec", packetPerSec);
55 }
double packetPerSec
Definition: Sink.h:35
double throughput
Definition: Sink.h:34
void inet::Sink::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
40 {
41  numPackets++;
42  cPacket *packet = PK(msg);
43  numBits += packet->getBitLength();
44  emit(rcvdPkSignal, packet);
45  throughput = numBits / simTime();
46  packetPerSec = numPackets / simTime();
47 
48  delete msg;
49 }
long numBits
Definition: Sink.h:33
double packetPerSec
Definition: Sink.h:35
int numPackets
Definition: Sink.h:32
double throughput
Definition: Sink.h:34
#define PK(msg)
Definition: INETDefs.h:92
static simsignal_t rcvdPkSignal
Definition: Sink.h:38
void inet::Sink::initialize ( )
overrideprotectedvirtual
27 {
28  numPackets = 0;
29  numBits = 0;
30  throughput = 0;
31  packetPerSec = 0;
32 
33  WATCH(numPackets);
34  WATCH(numBits);
35  WATCH(throughput);
36  WATCH(packetPerSec);
37 }
long numBits
Definition: Sink.h:33
double packetPerSec
Definition: Sink.h:35
int numPackets
Definition: Sink.h:32
double throughput
Definition: Sink.h:34

Member Data Documentation

long inet::Sink::numBits
protected

Referenced by handleMessage(), and initialize().

int inet::Sink::numPackets
protected

Referenced by handleMessage(), and initialize().

double inet::Sink::packetPerSec
protected

Referenced by finish(), handleMessage(), and initialize().

simsignal_t inet::Sink::rcvdPkSignal = registerSignal("rcvdPk")
staticprotected

Referenced by handleMessage().

double inet::Sink::throughput
protected

Referenced by finish(), handleMessage(), and initialize().


The documentation for this class was generated from the following files: