<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi guys,<div>    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,</div><div><br></div><div>1. Created a Nested Counter Class inside my Strategy class. It looks something like this - </div><div><br></div><div><div>  class CounterInfo : public StrategyInfo</div><div>  {</div><div>        public:</div><div>        static constexpr int</div><div>        getTypeId()</div><div>        {   return 1009; }</div><div><br></div><div>        CounterInfo() : m_count(0)</div><div>        {</div><div>        }</div><div><br></div><div>        void</div><div>        increment()</div><div>        {  ++m_count;}</div><div><br></div><div>        uint64_t</div><div>        get()</div><div>        {   return m_count; }</div><div>        private:</div><div>        uint64_t m_count;</div><div>  };</div></div><div><br></div><div>2. Then, in my AfterReceiveInterest() Trigger, I retrieve the entry using the piEntry APIs like this,</div><div><br></div><div><div>          CounterInfo *counter = pitEntry->getStrategyInfo<CounterInfo>();</div><div>          if(pitEntry->getStrategyInfo<CounterInfo>() == nullptr)</div><div>          {</div><div>                counter = new CounterInfo();</div><div>                counter->increment();</div><div>                pitEntry->insertStrategyInfo<CounterInfo>(*counter);</div><div>          }</div><div>          else</div><div>          {</div><div>                counter->increment();</div><div>          }</div></div><div><br></div><div>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 - </div><div><div><br></div><div> this->getMeasurements().extendLifetime(*entry, MEASUREMENTS_LIFETIME);</div><div><br></div></div><div>But even then, I didnt get the expected output. That is the counter variable is not counting the packets.</div><div><br></div><div>Instead, its count never gets past 1. I am sure this is because its getting instantiated newly everytime this strategy is applied.</div><div><br></div><div>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.</div><div><br></div><div>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. </div><div><br></div><div>Any pointers?? Any of my assumptions wrong?</div><div>Am I doing it the hard/correct way? Any other methods?</div><div><br></div></div></div></div></div>