<html><head><meta http-equiv="Content-Type" content="text/html charset=GB2312"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Hi Aaron,</div><div><br></div><div>Which version of ndnSIM are you using (commit ID)?  My latest version already contained GetPolicy() method in ContentStoreImpl class...</div><div><br></div><div>Not sure if you have modified <a href="http://content-store-impl.cc">content-store-impl.cc</a> class to instantiate ContentStores with AggregateStats policy, but that could be a problem.  In any case, after I added instantiations (I pushed my commit to github), I successfully run your scenario:</div><div><br></div><div><div>[cawka@cawka-mac ns-3 (ndnSIM)]$ ./waf --run ndn-simple-with-pit-operation-stats</div><div>Waf: Entering directory `/Users/cawka/Botan/ns3-ndn/ns-3/build'</div><div>Waf: Leaving directory `/Users/cawka/Botan/ns3-ndn/ns-3/build'</div><div>'build' finished successfully (1.386s)</div><div>PIT-Operation</div><div>Time<span class="Apple-tab-span" style="white-space:pre">     </span>NodeId<span class="Apple-tab-span" style="white-space:pre">      </span>Updates<span class="Apple-tab-span" style="white-space:pre">     </span>Inserts<span class="Apple-tab-span" style="white-space:pre">     </span>Lookups<span class="Apple-tab-span" style="white-space:pre">     </span>Erases</div><div>CS-Operation</div><div>Time<span class="Apple-tab-span" style="white-space:pre">        </span>NodeId<span class="Apple-tab-span" style="white-space:pre">      </span>Updates<span class="Apple-tab-span" style="white-space:pre">     </span>Inserts<span class="Apple-tab-span" style="white-space:pre">     </span>Lookups<span class="Apple-tab-span" style="white-space:pre">     </span>Erases</div><div>20<span class="Apple-tab-span" style="white-space:pre">     </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>200</div><div>20<span class="Apple-tab-span" style="white-space:pre">        </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>200</div><div>20<span class="Apple-tab-span" style="white-space:pre">        </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>200</div><div>20<span class="Apple-tab-span" style="white-space:pre">        </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>195</div><div>20<span class="Apple-tab-span" style="white-space:pre">        </span>1<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>195</div><div>20<span class="Apple-tab-span" style="white-space:pre">        </span>2<span class="Apple-tab-span" style="white-space:pre">   </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>200<span class="Apple-tab-span" style="white-space:pre"> </span>0<span class="Apple-tab-span" style="white-space:pre">   </span>195</div></div><div><br></div><div>---</div><div>Alex</div><div><br></div><br><div><div>On Feb 12, 2014, at 7:56 PM, aaronishere <<a href="mailto:aaronishere@qq.com">aaronishere@qq.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="font-size: 14px; font-family: Î¢ÈíÑźÚ; line-height: 1.5; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; margin: 10px;"><div>Hi, Alex</div><div> </div><div>I changed<span class="Apple-converted-space"> </span><a href="http://ndn-simple-with-pit-operation-stats.cc/">ndn-simple-with-pit-operation-stats.cc</a><span class="Apple-converted-space"> </span>like below so that both the times of insert/lookup/update/erase of CS and PIT can be shown:</div><div> </div><div>/////////////////////////////////////////////////////////////////////////////////////////////</div><div><div>#include "ns3/core-module.h"</div><div>#include "ns3/network-module.h"</div><div>#include "ns3/point-to-point-module.h"</div><div>#include "ns3/ndnSIM-module.h"</div><div>#include "ns3/ndnSIM/model/pit/ndn-pit-impl.h"</div><div>#include "ns3/ndnSIM/model/cs/content-store-impl.h"</div><div>#include "ns3/ndnSIM/utils/trie/persistent-policy.h"</div><div>#include "ns3/ndnSIM/utils/trie/random-policy.h"</div><div>#include "ns3/ndnSIM/utils/trie/lru-policy.h"</div><div>#include "ns3/ndnSIM/utils/trie/lfu-policy.h"</div><div>#include "ns3/ndnSIM/utils/trie/multi-policy.h"</div><div>#include "ns3/ndnSIM/utils/trie/aggregate-stats-policy.h"</div><div>using namespace ns3;</div><div> </div><div>typedef ndn::ndnSIM::multi_policy_traits< boost::mpl::vector2< ndn::ndnSIM::persistent_policy_traits,</div><div>                                                               ndn::ndnSIM::aggregate_stats_policy_traits > > PersistentWithCountsTraits;</div><div>typedef ndn::ndnSIM::multi_policy_traits< boost::mpl::vector2< ndn::ndnSIM::random_policy_traits,</div><div>                                                               ndn::ndnSIM::aggregate_stats_policy_traits > > RandomWithCountsTraits;</div><div>typedef ndn::ndnSIM::multi_policy_traits< boost::mpl::vector2< ndn::ndnSIM::lru_policy_traits,</div><div>                                                               ndn::ndnSIM::aggregate_stats_policy_traits > > LruWithCountsTraits;</div><div>typedef ndn::ndnSIM::multi_policy_traits< boost::mpl::vector2< ndn::ndnSIM::lfu_policy_traits,</div><div>                                                               ndn::ndnSIM::aggregate_stats_policy_traits > > LfuWithCountsTraits;</div><div> </div><div>void</div><div>PITPeriodicStatsPrinter (Ptr<Node> node, Time next)</div><div>{</div><div>  if (DynamicCast<ndn::pit::PitImpl<PersistentWithCountsTraits> > (node->GetObject<ndn::Pit> ()) == 0)</div><div>    {</div><div>      std::cerr << "Invalid PIT class, please correct the scenario" << std::endl;</div><div>      return;</div><div>    }</div><div></div><div>  //  "ns3::ndn::pit::Persistent::AggregateStats"</div><div>    ndn::pit::PitImpl<PersistentWithCountsTraits>::super::policy_container &policy =</div><div>    DynamicCast<ndn::pit::PitImpl<PersistentWithCountsTraits> > (node->GetObject<ndn::Pit> ())->GetPolicy ();</div><div> </div><div>    std::cout << Simulator::Now ().ToDouble (Time::S) << "\t"</div><div>              << node->GetId () << "\t"</div><div>              << policy.get<1> ().GetUpdates () << "\t"</div><div>              << policy.get<1> ().GetInserts () << "\t"</div><div>              << policy.get<1> ().GetLookups () << "\t"</div><div>              << policy.get<1> ().GetErases () << "\n";</div><div> </div><div>    policy.get<1> ().ResetStats ();</div><div></div><div>    Simulator::Schedule (next, PITPeriodicStatsPrinter, node, next);</div><div>}</div><div> </div><div><strong>void</strong></div><div><strong>CSPeriodicStatsPrinter (Ptr<Node> node, Time next)</strong></div><div><strong>{</strong></div><div><strong>  if (DynamicCast<ndn::cs::ContentStoreImpl<LfuWithCountsTraits> > (node->GetObject<ndn::ContentStore> ()) == 0)</strong></div><div><strong>    {</strong></div><div><strong>      std::cerr << "Invalid CS class, please correct the scenario" << std::endl;</strong></div><div><strong>      return;</strong></div><div><strong>    }</strong></div><div><strong></strong> </div><div><strong>    ndn::cs::ContentStoreImpl<LfuWithCountsTraits>::super::policy_container &policy =</strong></div><div><strong>    DynamicCast<ndn::cs::ContentStoreImpl<LfuWithCountsTraits> > (node->GetObject<ndn::ContentStore> ())->GetPolicy ();</strong></div><div><strong></strong> </div><div><strong>    std::cout << Simulator::Now ().ToDouble (Time::S) << "\t"</strong></div><div><strong>              << node->GetId () << "\t"</strong></div><div><strong>              << policy.get<1> ().GetUpdates () << "\t"</strong></div><div><strong>              << policy.get<1> ().GetInserts () << "\t"</strong></div><div><strong>              << policy.get<1> ().GetLookups () << "\t"</strong></div><div><strong>              << policy.get<1> ().GetErases () << "\n";</strong></div><div><strong></strong> </div><div><strong>    policy.get<1> ().ResetStats ();</strong></div><div><strong></strong></div><div><strong>    Simulator::Schedule (next, CSPeriodicStatsPrinter, node, next);</strong></div><div><strong>}</strong></div><div><strong></strong> </div><div>int</div><div>main (int argc, char *argv[])</div><div>{</div><div>  // setting default parameters for PointToPoint links and channels</div><div>  Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("1Mbps"));</div><div>  Config::SetDefault ("ns3::PointToPointChannel::Delay", StringValue ("10ms"));</div><div>  Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("20"));</div><div> </div><div>  // Read optional command-line parameters (e.g., enable visualizer with ./waf --run=<> --visualize</div><div>  CommandLine cmd;</div><div>  cmd.Parse (argc, argv);</div><div> </div><div>  // Creating nodes</div><div>  NodeContainer nodes;</div><div>  nodes.Create (3);</div><div> </div><div>  // Connecting nodes using two links</div><div>  PointToPointHelper p2p;</div><div>  p2p.Install (nodes.Get (0), nodes.Get (1));</div><div>  p2p.Install (nodes.Get (1), nodes.Get (2));</div><div> </div><div>  // Install CCNx stack on all nodes</div><div>  ndn::StackHelper ndnHelper;</div><div>  ndnHelper.SetDefaultRoutes (true);</div><div>  ndnHelper.SetPit ("ns3::ndn::pit::Persistent::AggregateStats");</div><div>  ndnHelper.SetContentStore ("ns3::ndn::cs::Lfu::AggregateStats", "MaxSize", "5");</div><div>  ndnHelper.InstallAll ();</div><div></div><div>  std::cout << "PIT-Operation"<<"\n";</div><div>  std::cout << "Time" << "\t"</div><div>            << "NodeId" << "\t"</div><div>            << "Updates" << "\t"</div><div>            << "Inserts" << "\t"</div><div>            << "Lookups" << "\t"</div><div>            << "Erases" << "\n";</div><div>   for (uint32_t i=0; i<nodes.GetN (); i++)</div><div>  // set up periodic PIT stats printer on node 1</div><div>    {</div><div>      Simulator::Schedule (Seconds (20), PITPeriodicStatsPrinter, nodes.Get (i), Seconds (20));</div><div>    }</div><div> </div><div> <strong><span class="Apple-converted-space"> </span>std::cout << "CS-Operation"<<"\n";</strong></div><div><strong>  std::cout << "Time" << "\t"</strong></div><div><strong>            << "NodeId" << "\t"</strong></div><div><strong>            << "Updates" << "\t"</strong></div><div><strong>            << "Inserts" << "\t"</strong></div><div><strong>            << "Lookups" << "\t"</strong></div><div><strong>            << "Erases" << "\n";</strong></div><div><strong>   for (uint32_t i=0; i<nodes.GetN (); i++)</strong></div><div><strong>  // set up periodic PIT stats printer on node 1</strong></div><div><strong>    {</strong></div><div><strong>      Simulator::Schedule (Seconds (20), CSPeriodicStatsPrinter, nodes.Get (i), Seconds (20));</strong></div><div><strong>    }</strong></div><div>  // Installing applications</div><div>........</div><div>/////////////////////////////////////////////////////////////////</div><div>However, it errors like below</div><div> </div><div>[1207/2311] cxx: src/ndnSIM/examples/<a href="http://ndn-simple-with-pit-operation-stats.cc/">ndn-simple-with-pit-operation-stats.cc</a><span class="Apple-converted-space"> </span>-> build/src/ndnSIM/examples/<a href="http://ndn-simple-with-pit-operation-stats.cc/">ndn-simple-with-pit-operation-stats.cc</a>.21.o</div><div>../src/ndnSIM/examples/<a href="http://ndn-simple-with-pit-operation-stats.cc/">ndn-simple-with-pit-operation-stats.cc</a>: In function ¡®void CSPeriodicStatsPrinter(ns3::Ptr<ns3::Node>, ns3::Time)¡¯:</div><div>../src/ndnSIM/examples/<a href="http://ndn-simple-with-pit-operation-stats.cc/">ndn-simple-with-pit-operation-stats.cc</a>:102:107: error: ¡®class ns3::ndn::cs::ContentStoreImpl<ns3::ndn::ndnSIM::multi_policy_traits<boost::mpl::vector2<ns3::ndn::ndnSIM::lfu_policy_traits, ns3::ndn::ndnSIM::aggregate_stats_policy_traits> > >¡¯ has no member named ¡®GetPolicy¡¯</div><div> </div><div>I checked the content-store-impl.h and there is no function called GetPolicy while in the pit-impl.h has.</div><div>And I add</div><div><div><strong>  const typename super::policy_container &</strong></div><div> <strong><span class="Apple-converted-space"> </span>GetPolicy () const { return super::getPolicy (); }</strong></div><div><strong>  typename super::policy_container &</strong></div><div><strong>  GetPolicy () { return super::getPolicy (); }</strong></div><div>to the content-store-impl.h as the pit-impl.h has and it can compile but has a segment default.</div><div> </div><div><div>[Thread debugging using libthread_db enabled]</div><div>Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".</div><div> </div><div>Program received signal SIGSEGV, Segmentation fault.</div><div>0x00007ffff0abcf28 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) ()</div><div>   from /usr/lib/x86_64-linux-gnu/libstdc++.so.6</div><div> </div><div>Thus, how to write GetPolicy( ) function in the content-store-impl.h?</div><div> </div><div>Thanks in advance!</div><div> </div></div></div></div><hr align="left" size="1" style="height: 1px; width: 210px;"><div><span>Aaron</span></div></div></blockquote></div><br></body></html>