[ndnSIM] Counting the number of interest packets received in a Namespace
Dyaneswaran S
dyaneswaran16028 at cse.ssn.edu.in
Tue Feb 4 11:31:37 PST 2020
Hi guys,
My objective is to count the no of interest packets received in a node.
Since this looked like the kind of namespace specific information that can
be stored in the Measurements Table, I did the following as suggested in
the NFD Developers Guide and other strategies in the forwarder,
1. Created a Nested Counter Class inside my Strategy class. It looks
something like this -
class CounterInfo : public StrategyInfo
{
public:
static constexpr int
getTypeId()
{ return 1009; }
CounterInfo() : m_count(0)
{
}
void
increment()
{ ++m_count;}
uint64_t
get()
{ return m_count; }
private:
uint64_t m_count;
};
2. Then, in my AfterReceiveInterest() Trigger, I retrieve the entry using
the piEntry APIs like this,
CounterInfo *counter = pitEntry->getStrategyInfo<CounterInfo>();
if(pitEntry->getStrategyInfo<CounterInfo>() == nullptr)
{
counter = new CounterInfo();
counter->increment();
pitEntry->insertStrategyInfo<CounterInfo>(*counter);
}
else
{
counter->increment();
}
3. I thought the above 2 steps were sufficient, but apparently not. So
after more digging, I found out I had to extend the Lifetime of
Measurements Table Entries. I was not sure how Measurements and
StrategyInfo Class were interrelated but I did it anyway. (superstitious, I
agree). That looked like -
this->getMeasurements().extendLifetime(*entry, MEASUREMENTS_LIFETIME);
But even then, I didnt get the expected output. That is the counter
variable is not counting the packets.
Instead, its count never gets past 1. I am sure this is because its getting
instantiated newly everytime this strategy is applied.
Somehow, its not accessing the already stored strategy info. I thought it
was because of the different pit entries causing new measurement entries
(since measurements are accessed via pitentries). But I made sure that
didnt happen as well.
I thought about approximating the count of interest packets to the no. of
PIT inrecords but that was ridiculous. I needed the actual count of
interest packets.
Any pointers?? Any of my assumptions wrong?
Am I doing it the hard/correct way? Any other methods?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20200205/04426c9a/attachment.html>
More information about the ndnSIM
mailing list