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

ZHANG, Lu lu.zhang at fuji.waseda.jp
Tue Jun 13 00:55:36 PDT 2017


Dear Junxiao and all,

Thanks for your answer. In fact there may be something wrong with my
expression. What I really want to know is the traffic payload at a certain
second( in kilobyte or something).

As you know, function "data-> GetWire() -> GetSize()" can give the result
of payload at a moment, as I get this info from "ndn-l3-rate-tracer.cc":

*void*
*L3RateTracer::OutData  (Ptr<const Data> data,*
*                        bool fromCache, Ptr<const Face> face)*
*{*
*  m_stats[face].get<0> ().m_outData ++;*
*  if (data->GetWire ())*
*    {*
*      m_stats[face].get<1> ().m_outData += data->GetWire ()->GetSize (); *
*    }*
*}*

Sorry for any misunderstanding about my previous question.

1 more question is, I cannot use time(NULL) function in file
"ndn-forwarding-strategy.cc" as I always get the error

*"error: expected primary-expression before ‘(’ token"*
*lastTime=time(NULL);*
*                      ^*
I did something like this:

in "ndn-forwarding strategy.h" I put below* in public field.*

  int  lastTime;
  int  now;

When I was invoking lastTime by using "*lastTime =time(NULL)*", I got the
problem above.

It should be a simple problem but I just cannot find the reason. Would you
please help?

Thanks in advance and best wishes,

Lu Zhang



2017年6月12日星期一,Junxiao Shi <shijunxiao at email.arizona.edu> 写道:

> 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/20170613/d5f67270/attachment.html>


More information about the ndnSIM mailing list