<div dir="ltr">Dear Junxiao and all,<div><br></div><div>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). </div><div><br></div><div>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":<span></span></div><div><br></div><div><div><b>void</b></div><div><b>L3RateTracer::OutData  (Ptr<const Data> data,</b></div><div><b>                        bool fromCache, Ptr<const Face> face)</b></div><div><b>{</b></div><div><b>  m_stats[face].get<0> ().m_outData ++;</b></div><div><b>  if (data->GetWire ())</b></div><div><b>    {</b></div><div><b>      m_stats[face].get<1> ().m_outData += data->GetWire ()->GetSize (); </b></div><div><b>    }</b></div><div><b>}</b></div></div><div><br></div><div>Sorry for any misunderstanding about my previous question.</div><div><br></div><div>1 more question is, I cannot use time(NULL) function in file "ndn-forwarding-strategy.cc" as I always get the error </div><div><b><br></b></div><div><b>"error: expected primary-expression before ‘(’ token"</b></div><div><div><b>lastTime=time(NULL);</b></div></div><div><b>                      ^</b></div><div>I did something like this:</div><div><br></div><div>in "ndn-forwarding strategy.h" I put below<b> in public field.</b></div><div><b><br></b></div><div><div style="font-weight:bold">  int  lastTime;</div><div style="font-weight:bold">  int  now;</div><div style="font-weight:bold"><br></div><div>When I was invoking lastTime by using "<b>lastTime =time(NULL)</b>", I got the problem above.</div><div><br></div><div>It should be a simple problem but I just cannot find the reason. Would you please help?</div></div><div><br></div><div>Thanks in advance and best wishes,</div><div><br></div><div>Lu Zhang</div><div><br></div><div><br></div><div><br>2017年6月12日星期一,Junxiao Shi <<a href="mailto:shijunxiao@email.arizona.edu" target="_blank">shijunxiao@email.arizona.edu</a>> 写道:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr">Hi Lu<br><div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>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.</div></div></blockquote><br></div><div class="gmail_quote">You may get Interest and Data size as follows:<br></div><div class="gmail_quote"><div style="margin-left:40px"><span style="font-family:monospace,monospace">size_t pktSize = interest.wireEncode().size(); <br></span></div><div><div style="margin-left:40px"><span style="font-family:monospace,monospace">size_t pktSize = data.wireEncode().size(); </span><br></div><div>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.<br></div></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Most importantly, I want the value to be get once per second.</div></div></blockquote><div>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.<br></div><div>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.<br>Collected information should be placed in the measurements table. Strategy instance itself must be stateless.<br></div><div><br></div><div>Yours, Junxiao <br></div></div></div></div></div>
</blockquote></div>
</div>