INET Framework for OMNeT++/OMNEST
inet::queueing::FlowMeasurementRecorder Class Reference

#include <FlowMeasurementRecorder.h>

Inheritance diagram for inet::queueing::FlowMeasurementRecorder:
inet::queueing::PacketFlowBase inet::queueing::PacketProcessorBase inet::queueing::IPacketFlow inet::queueing::IPacketCollection inet::queueing::IPacketProcessor inet::StringFormat::IDirectiveResolver inet::queueing::IPacketSink inet::queueing::IPacketSource inet::queueing::IPassivePacketSink inet::queueing::IActivePacketSink inet::queueing::IPassivePacketSource inet::queueing::IActivePacketSource

Public Member Functions

virtual void processPacket (Packet *packet) override
 
- Public Member Functions inherited from inet::queueing::PacketFlowBase
virtual IPassivePacketSinkgetConsumer (cGate *gate) override
 Returns the passive packet sink where packets are pushed or nullptr if the connected module doesn't implement the interface. More...
 
virtual IPassivePacketSourcegetProvider (cGate *gate) override
 Returns the passive packet source from where packets are pulled or nullptr if the connected module doesn't implement the interface. More...
 
virtual bool supportsPacketPushing (cGate *gate) const override
 Returns true if the processor supports pushing packets at the given gate. More...
 
virtual bool supportsPacketPulling (cGate *gate) const override
 Returns true if the processor supports pulling packets at the given gate. More...
 
virtual bool supportsPacketStreaming (cGate *gate) const override
 Returns true if the processor supports streaming packets at the given gate. More...
 
virtual bool canPushSomePacket (cGate *gate) const override
 Returns false if the packet sink is full at the given gate and no more packets can be pushed into it without raising an error. More...
 
virtual bool canPushPacket (Packet *packet, cGate *gate) const override
 Returns true if the given packet can be pushed at the given gate into the packet sink without raising an error. More...
 
virtual void pushPacket (Packet *packet, cGate *gate) override
 Pushes the packet into the packet sink at the given gate. More...
 
virtual void pushPacketStart (Packet *packet, cGate *gate, bps datarate) override
 Starts pushing the packet into the packet sink at the given gate. More...
 
virtual void pushPacketEnd (Packet *packet, cGate *gate) override
 Ends pushing the packet into the packet sink at the given gate. More...
 
virtual void pushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength=b(0)) override
 Progresses pushing the packet into the packet sink at the given gate. More...
 
virtual void handleCanPushPacketChanged (cGate *gate) override
 Notifies about a change in the possibility of pushing some packet into the passive packet sink at the given gate. More...
 
virtual void handlePushPacketProcessed (Packet *packet, cGate *gate, bool successful) override
 Notifies about the completion of the packet processing for a packet that was pushed earlier independently whether the packet is passed or streamed. More...
 
virtual bool canPullSomePacket (cGate *gate) const override
 Returns false if the packet source is empty at the given gate and no more packets can be pulled from it without raising an error. More...
 
virtual PacketcanPullPacket (cGate *gate) const override
 Returns the packet that can be pulled at the given gate. More...
 
virtual PacketpullPacket (cGate *gate) override
 Pulls the packet from the packet source at the given gate. More...
 
virtual PacketpullPacketStart (cGate *gate, bps datarate) override
 Starts pulling the packet from the packet source at the given gate. More...
 
virtual PacketpullPacketEnd (cGate *gate) override
 Ends pulling the packet from the packet source at the given gate. More...
 
virtual PacketpullPacketProgress (cGate *gate, bps datarate, b position, b extraProcessableLength) override
 Progresses pulling the packet from the packet source at the given gate. More...
 
virtual void handleCanPullPacketChanged (cGate *gate) override
 Notifies about a change in the possibility of pulling some packet from the passive packet source at the given gate. More...
 
virtual void handlePullPacketProcessed (Packet *packet, cGate *gate, bool successful) override
 Notifies about the completion of the packet processing for a packet that was pulled earlier independently whether the packet is passed or streamed. More...
 
virtual int getMaxNumPackets () const override
 Returns maximum allowed number of packets in the collection. More...
 
virtual int getNumPackets () const override
 Returns the number of available packets in the collection in the range [0, inf). More...
 
virtual b getMaxTotalLength () const override
 Returns maximum allowed total length of all packets in the collection. More...
 
virtual b getTotalLength () const override
 Returns the total length of all packets in the collection in the range [0, inf). More...
 
virtual PacketgetPacket (int index) const override
 Returns the packet at the given index. More...
 
virtual bool isEmpty () const override
 Returns true if there are no packets available in the collection. More...
 
virtual void removePacket (Packet *packet) override
 Removes a packet from the collection. More...
 
virtual void removeAllPackets () override
 Removes all packets from the collection. More...
 
- Public Member Functions inherited from inet::queueing::PacketProcessorBase
virtual bool supportsPacketSending (cGate *gate) const override
 Returns true if the processor supports sending packets at the given gate. More...
 
virtual bool supportsPacketPassing (cGate *gate) const override
 Returns true if the processor supports passing packets as a whole at the given gate. More...
 
virtual const char * resolveDirective (char directive) const override
 
- Public Member Functions inherited from inet::queueing::IPacketProcessor
virtual ~IPacketProcessor ()
 
- Public Member Functions inherited from inet::queueing::IPassivePacketSink
virtual ~IPassivePacketSink ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSink
virtual ~IActivePacketSink ()
 
- Public Member Functions inherited from inet::queueing::IPassivePacketSource
virtual ~IPassivePacketSource ()
 
- Public Member Functions inherited from inet::queueing::IActivePacketSource
virtual ~IActivePacketSource ()
 

Static Public Attributes

static simsignal_t packetFlowMeasuredSignal = cComponent::registerSignal("packetFlowMeasured")
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void makeMeasurement (Packet *packet, b offset, b length, const char *flowName, simsignal_t bitSignal, simsignal_t bitPerRegionSignal, simsignal_t packetPerBitSignal, simsignal_t packetPerRegionSignal, simtime_t bitValue, simtime_t packetValue)
 
virtual void makeMeasurements (Packet *packet)
 
virtual void endMeasurements (Packet *packet)
 
template<typename T >
void makeMeasurement (Packet *packet, b offset, b length, simsignal_t bitSignal, simsignal_t bitPerRegionSignal, simsignal_t packetPerBitSignal, simsignal_t packetPerRegionSignal)
 
template<typename T >
void endMeasurement (Packet *packet, b offset, b length)
 
- Protected Member Functions inherited from inet::queueing::PacketFlowBase
virtual void handleMessage (cMessage *message) override
 
virtual bool isStreamingPacket () const
 
virtual void startPacketStreaming (Packet *packet)
 
virtual void endPacketStreaming (Packet *packet)
 
virtual void checkPacketStreaming (Packet *packet)
 
- Protected Member Functions inherited from inet::queueing::PacketProcessorBase
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void handlePacketProcessed (Packet *packet)
 
virtual void checkPacketOperationSupport (cGate *gate) const
 
virtual void checkPacketOperationSupport (cGate *startGate, cGate *endGate) const
 
virtual void animate (Packet *packet, cGate *gate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacket (Packet *packet, cGate *gate, Action action) const
 
virtual void animatePacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId, Action action) const
 
virtual void animatePacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacketEnd (Packet *packet, cGate *gate, long transmissionId, Action action) const
 
virtual void animatePacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions, Action action) const
 
virtual void animatePacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId, Action action) const
 
virtual void animatePacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions, Action action) const
 
virtual void pushOrSendPacket (Packet *packet, cGate *gate, IPassivePacketSink *consumer)
 
virtual void pushOrSendPacketStart (Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, int transmissionId)
 
virtual void pushOrSendPacketEnd (Packet *packet, cGate *gate, IPassivePacketSink *consumer, int transmissionId)
 
virtual void pushOrSendPacketProgress (Packet *packet, cGate *gate, IPassivePacketSink *consumer, bps datarate, b position, b extraProcessableLength, int transmissionId)
 
virtual void animatePush (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePushPacket (Packet *packet, cGate *gate) const
 
virtual void animatePushPacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId) const
 
virtual void animatePushPacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions) const
 
virtual void animatePushPacketEnd (Packet *packet, cGate *gate, long transmissionId) const
 
virtual void animatePushPacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId) const
 
virtual void animatePushPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions) const
 
virtual void animatePull (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePullPacket (Packet *packet, cGate *gate) const
 
virtual void animatePullPacketStart (Packet *packet, cGate *gate, bps datarate, long transmissionId) const
 
virtual void animatePullPacketStart (Packet *packet, cGate *gate, bps datarate, const SendOptions &sendOptions) const
 
virtual void animatePullPacketEnd (Packet *packet, cGate *gate, long transmissionId) const
 
virtual void animatePullPacketEnd (Packet *packet, cGate *gate, const SendOptions &sendOptions) const
 
virtual void animatePullPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, long transmissionId) const
 
virtual void animatePullPacketProgress (Packet *packet, cGate *gate, bps datarate, b position, b extraProcessableLength, const SendOptions &sendOptions) const
 
virtual void dropPacket (Packet *packet, PacketDropReason reason, int limit=-1)
 
virtual void updateDisplayString () const
 

Protected Attributes

PacketFilter packetFilter
 
b offset = b(0)
 
b length = b(-1)
 
bool endMeasurement_ = false
 
const char * flowName = nullptr
 
cMatchExpression flowNameMatcher
 
bool measureLifeTime = false
 
bool measureElapsedTime = false
 
bool measureDelayingTime = false
 
bool measureQueueingTime = false
 
bool measureProcessingTime = false
 
bool measureTransmissionTime = false
 
bool measurePropagationTime = false
 
- Protected Attributes inherited from inet::queueing::PacketFlowBase
cGate * inputGate = nullptr
 
ModuleRef< IActivePacketSourceproducer
 
ModuleRef< IPassivePacketSourceprovider
 
ModuleRef< IPacketCollectioncollection
 
cGate * outputGate = nullptr
 
ModuleRef< IPassivePacketSinkconsumer
 
ModuleRef< IActivePacketSinkcollector
 
int inProgressStreamId = -1
 
- Protected Attributes inherited from inet::queueing::PacketProcessorBase
const char * displayStringTextFormat = nullptr
 
int numProcessedPackets = -1
 
b processedTotalLength = b(-1)
 

Additional Inherited Members

- Protected Types inherited from inet::queueing::PacketProcessorBase
enum  Action { PUSH, PULL }
 

Member Function Documentation

◆ endMeasurement()

template<typename T >
void inet::queueing::FlowMeasurementRecorder::endMeasurement ( Packet packet,
b  offset,
b  length 
)
inlineprotected
57  {
58  packet->mapAllRegionTagsForUpdate<T>(offset, length, [&] (b o, b l, const Ptr<T>& timeTag) {
59  for (int i = 0; i < (int)timeTag->getBitTotalTimesArraySize(); i++) {
60  auto flowName = timeTag->getFlowNames(i);
61  cMatchableString matchableFlowName(flowName);
62  if (flowNameMatcher.matches(&matchableFlowName)) {
63  EV_INFO << "Stopping measurement on packet" << EV_FIELD(offset) << EV_FIELD(length);
64  if (flowName != nullptr && *flowName != '\0')
65  EV_INFO << EV_FIELD(flowName);
66  EV_INFO << EV_FIELD(packet) << EV_ENDL;
67  timeTag->eraseFlowNames(i);
68  timeTag->eraseBitTotalTimes(i);
69  timeTag->erasePacketTotalTimes(i);
70  i--;
71  break;
72  }
73  }
74  });
75  }

◆ endMeasurements()

void inet::queueing::FlowMeasurementRecorder::endMeasurements ( Packet packet)
protectedvirtual
80 {
81  std::set<std::string> endedFlowNames;
82  b length = this->length == b(-1) ? packet->getTotalLength() - offset : this->length;
84  endMeasurement<ElapsedTimeTag>(packet, offset, length);
86  endMeasurement<DelayingTimeTag>(packet, offset, length);
88  endMeasurement<QueueingTimeTag>(packet, offset, length);
90  endMeasurement<ProcessingTimeTag>(packet, offset, length);
92  endMeasurement<TransmissionTimeTag>(packet, offset, length);
94  endMeasurement<PropagationTimeTag>(packet, offset, length);
95  packet->mapAllRegionTagsForUpdate<FlowTag>(offset, length, [&] (b o, b l, const Ptr<FlowTag>& flowTag) {
96  for (int i = 0; i < (int)flowTag->getNamesArraySize(); i++) {
97  auto flowName = flowTag->getNames(i);
98  cMatchableString matchableFlowName(flowName);
99  if (flowNameMatcher.matches(&matchableFlowName)) {
100  endedFlowNames.insert(flowName);
101  flowTag->eraseNames(i);
102  i--;
103  }
104  }
105  });
106  for (auto& flowName : endedFlowNames)
107  endPacketFlow(this, packet, flowName.c_str());
108 }

Referenced by processPacket().

◆ initialize()

void inet::queueing::FlowMeasurementRecorder::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::queueing::PacketFlowBase.

26 {
28  if (stage == INITSTAGE_LOCAL) {
29  packetFilter.setExpression(par("packetFilter").objectValue());
30  offset = b(par("offset"));
31  length = b(par("length"));
32  endMeasurement_ = par("endMeasurement");
33  flowName = par("flowName");
34  flowNameMatcher.setPattern(flowName, false, true, true);
35  cMatchExpression measureMatcher;
36  measureMatcher.setPattern(par("measure"), false, true, true);
37  measureLifeTime = matchesString(measureMatcher, "lifeTime");
38  measureElapsedTime = matchesString(measureMatcher, "elapsedTime");
39  measureDelayingTime = matchesString(measureMatcher, "delayingTime");
40  measureQueueingTime = matchesString(measureMatcher, "queueingTime");
41  measureProcessingTime = matchesString(measureMatcher, "processingTime");
42  measureTransmissionTime = matchesString(measureMatcher, "transmissionTime");
43  measurePropagationTime = matchesString(measureMatcher, "propagationTime");
44  }
45 }

◆ makeMeasurement() [1/2]

void inet::queueing::FlowMeasurementRecorder::makeMeasurement ( Packet packet,
b  offset,
b  length,
const char *  flowName,
simsignal_t  bitSignal,
simsignal_t  bitPerRegionSignal,
simsignal_t  packetPerBitSignal,
simsignal_t  packetPerRegionSignal,
simtime_t  bitValue,
simtime_t  packetValue 
)
protectedvirtual
57 {
58  EV_INFO << "Making measurement on packet" << EV_FIELD(offset) << EV_FIELD(length);
59  if (flowName != nullptr && *flowName != '\0')
60  EV_INFO << EV_FIELD(flowName);
61  EV_INFO << EV_FIELD(bitSignal, cComponent::getSignalName(bitSignal)) << EV_FIELD(bitValue) << EV_FIELD(packet) << EV_ENDL;
62  cNamedObject details(flowName);
63  // TODO: use weighted value when available in omnetpp
64  for (int i = 0; i < length.get(); i++) {
65  emit(bitSignal, bitValue, &details);
66  if (packetPerBitSignal != -1)
67  emit(packetPerBitSignal, packetValue, &details);
68  }
69  emit(bitPerRegionSignal, bitValue, &details);
70  if (packetPerRegionSignal != -1)
71  emit(packetPerRegionSignal, packetValue, &details);
72 }

◆ makeMeasurement() [2/2]

template<typename T >
void inet::queueing::FlowMeasurementRecorder::makeMeasurement ( Packet packet,
b  offset,
b  length,
simsignal_t  bitSignal,
simsignal_t  bitPerRegionSignal,
simsignal_t  packetPerBitSignal,
simsignal_t  packetPerRegionSignal 
)
inlineprotected
45  {
46  packet->mapAllRegionTags<T>(offset, length, [&] (b o, b l, const Ptr<const T>& timeTag) {
47  for (int i = 0; i < (int)timeTag->getBitTotalTimesArraySize(); i++) {
48  auto flowName = timeTag->getFlowNames(i);
49  cMatchableString matchableFlowName(flowName);
50  if (flowNameMatcher.matches(&matchableFlowName))
51  makeMeasurement(packet, o, l, flowName, bitSignal, bitPerRegionSignal, packetPerBitSignal, packetPerRegionSignal, timeTag->getBitTotalTimes(i), timeTag->getPacketTotalTimes(i));
52  }
53  });
54  }

◆ makeMeasurements()

void inet::queueing::FlowMeasurementRecorder::makeMeasurements ( Packet packet)
protectedvirtual
75 {
76  emit(packetFlowMeasuredSignal, packet);
77 }

Referenced by processPacket().

◆ processPacket()

void inet::queueing::FlowMeasurementRecorder::processPacket ( Packet packet)
overridevirtual

Implements inet::queueing::PacketFlowBase.

48 {
49  if (packetFilter.matches(packet)) {
50  makeMeasurements(packet);
51  if (endMeasurement_)
52  endMeasurements(packet);
53  }
54 }

Member Data Documentation

◆ endMeasurement_

bool inet::queueing::FlowMeasurementRecorder::endMeasurement_ = false
protected

Referenced by initialize(), and processPacket().

◆ flowName

const char* inet::queueing::FlowMeasurementRecorder::flowName = nullptr
protected

◆ flowNameMatcher

cMatchExpression inet::queueing::FlowMeasurementRecorder::flowNameMatcher
protected

Referenced by endMeasurements(), and initialize().

◆ length

b inet::queueing::FlowMeasurementRecorder::length = b(-1)
protected

◆ measureDelayingTime

bool inet::queueing::FlowMeasurementRecorder::measureDelayingTime = false
protected

Referenced by endMeasurements(), and initialize().

◆ measureElapsedTime

bool inet::queueing::FlowMeasurementRecorder::measureElapsedTime = false
protected

Referenced by endMeasurements(), and initialize().

◆ measureLifeTime

bool inet::queueing::FlowMeasurementRecorder::measureLifeTime = false
protected

Referenced by initialize().

◆ measureProcessingTime

bool inet::queueing::FlowMeasurementRecorder::measureProcessingTime = false
protected

Referenced by endMeasurements(), and initialize().

◆ measurePropagationTime

bool inet::queueing::FlowMeasurementRecorder::measurePropagationTime = false
protected

Referenced by endMeasurements(), and initialize().

◆ measureQueueingTime

bool inet::queueing::FlowMeasurementRecorder::measureQueueingTime = false
protected

Referenced by endMeasurements(), and initialize().

◆ measureTransmissionTime

bool inet::queueing::FlowMeasurementRecorder::measureTransmissionTime = false
protected

Referenced by endMeasurements(), and initialize().

◆ offset

b inet::queueing::FlowMeasurementRecorder::offset = b(0)
protected

◆ packetFilter

PacketFilter inet::queueing::FlowMeasurementRecorder::packetFilter
protected

Referenced by initialize(), and processPacket().

◆ packetFlowMeasuredSignal

simsignal_t inet::queueing::FlowMeasurementRecorder::packetFlowMeasuredSignal = cComponent::registerSignal("packetFlowMeasured")
static

Referenced by makeMeasurements().


The documentation for this class was generated from the following files:
inet::queueing::FlowMeasurementRecorder::measureProcessingTime
bool measureProcessingTime
Definition: FlowMeasurementRecorder.h:34
inet::queueing::FlowMeasurementRecorder::flowName
const char * flowName
Definition: FlowMeasurementRecorder.h:28
inet::units::units::T
compose< Wb, pow< m, -2 > > T
Definition: Units.h:951
inet::queueing::FlowMeasurementRecorder::endMeasurement_
bool endMeasurement_
Definition: FlowMeasurementRecorder.h:27
inet::queueing::FlowMeasurementRecorder::endMeasurements
virtual void endMeasurements(Packet *packet)
Definition: FlowMeasurementRecorder.cc:79
inet::queueing::FlowMeasurementRecorder::measureElapsedTime
bool measureElapsedTime
Definition: FlowMeasurementRecorder.h:31
inet::queueing::FlowMeasurementRecorder::packetFilter
PacketFilter packetFilter
Definition: FlowMeasurementRecorder.h:24
EV_FIELD
#define EV_FIELD(...)
Definition: INETDefs.h:112
inet::queueing::FlowMeasurementRecorder::measureLifeTime
bool measureLifeTime
Definition: FlowMeasurementRecorder.h:30
inet::queueing::FlowMeasurementRecorder::makeMeasurement
virtual void makeMeasurement(Packet *packet, b offset, b length, const char *flowName, simsignal_t bitSignal, simsignal_t bitPerRegionSignal, simsignal_t packetPerBitSignal, simsignal_t packetPerRegionSignal, simtime_t bitValue, simtime_t packetValue)
Definition: FlowMeasurementRecorder.cc:56
inet::queueing::FlowMeasurementRecorder::offset
b offset
Definition: FlowMeasurementRecorder.h:25
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::queueing::FlowMeasurementRecorder::makeMeasurements
virtual void makeMeasurements(Packet *packet)
Definition: FlowMeasurementRecorder.cc:74
inet::units::values::b
value< int64_t, units::b > b
Definition: Units.h:1241
inet::queueing::PacketFlowBase::initialize
virtual void initialize(int stage) override
Definition: PacketFlowBase.cc:15
inet::queueing::FlowMeasurementRecorder::flowNameMatcher
cMatchExpression flowNameMatcher
Definition: FlowMeasurementRecorder.h:29
inet::endPacketFlow
void endPacketFlow(cModule *module, Packet *packet, const char *name)
Definition: FlowTag.cc:28
inet::queueing::FlowMeasurementRecorder::length
b length
Definition: FlowMeasurementRecorder.h:26
inet::queueing::FlowMeasurementRecorder::measurePropagationTime
bool measurePropagationTime
Definition: FlowMeasurementRecorder.h:36
inet::units::value::get
const value_type & get() const
Definition: Units.h:108
inet::queueing::FlowMeasurementRecorder::measureTransmissionTime
bool measureTransmissionTime
Definition: FlowMeasurementRecorder.h:35
inet::queueing::FlowMeasurementRecorder::measureQueueingTime
bool measureQueueingTime
Definition: FlowMeasurementRecorder.h:33
inet::queueing::FlowMeasurementRecorder::measureDelayingTime
bool measureDelayingTime
Definition: FlowMeasurementRecorder.h:32
EV_ENDL
#define EV_ENDL
Definition: INETDefs.h:114
inet::queueing::FlowMeasurementRecorder::packetFlowMeasuredSignal
static simsignal_t packetFlowMeasuredSignal
Definition: FlowMeasurementRecorder.h:21