[ndnSIM] How to get the current data packet size of a certain interface per second?

Junxiao Shi shijunxiao at email.arizona.edu
Mon Jun 12 05:04:30 PDT 2017


Hi Lu

I want to get the packet size as I want to calculate if there is any
> congestion. I would like to get the value and invoke this value by other
> functions in ForwardingStretegy.
>

You may get Interest and Data size as follows:
size_t pktSize = interest.wireEncode().size();
size_t pktSize = data.wireEncode().size();
These reflect the number of octets in the network-layer packet. Forwarding
does not have access to the link-layer packet, so there's no way to get
LpPacket size or Nack size. If you really need LpPacket size, you'll have
to add a tag in LinkService.

Most importantly, I want the value to be get once per second.
>
Forwarding is event-driven and triggerred every time a packet arrives. It
does not make sense to get the packet size of a given second if no packet
arrives within that second.
For the periods in which there are packet arrivals, you may use the code
above to collect the size of each packet, and do an average.
Collected information should be placed in the measurements table. Strategy
instance itself must be stateless.

Yours, Junxiao
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20170612/f70c6607/attachment.html>


More information about the ndnSIM mailing list