20 #ifndef NDN_CONTENT_STORE_WITH_STATS_H_ 21 #define NDN_CONTENT_STORE_WITH_STATS_H_ 23 #include "ns3/ndnSIM/model/ndn-common.hpp" 27 #include "../../utils/trie/multi-policy.hpp" 38 template<
class Policy>
41 multi_policy_traits<boost::mpl::
44 lifetime_stats_policy_traits>>> {
47 multi_policy_traits<boost::mpl::
49 ndnSIM::lifetime_stats_policy_traits>>>
57 super::getPolicy().template get<1>().set_traced_callback(&m_willRemoveEntry);
64 Print(std::ostream& os)
const;
70 static LogComponent g_log;
74 TracedCallback<Ptr<const Entry>, Time> m_willRemoveEntry;
81 template<
class Policy>
83 + Policy::GetName()).c_str(), __FILE__);
85 template<
class Policy>
90 TypeId((
"ns3::ndn::cs::Stats::" + Policy::GetName()).c_str())
95 .AddTraceSource(
"WillRemoveEntry",
96 "Trace called just before content store entry will be removed",
98 "ns3::ndn::cs::ContentStoreWithStats::RemoveCsEntryCallback")
106 template<
class Policy>
113 for (
typename super::policy_container::const_iterator item = this->getPolicy().begin();
114 item != this->getPolicy().end(); item++) {
115 Time alive = lifetime_stats_container::policy_base::get_time(&(*item)) - Simulator::Now();
116 os << item->payload()->GetName() <<
"(alive: " << alive.ToDouble(Time::S) <<
"s)" << std::endl;
124 #endif // NDN_CONTENT_STORE_IMPL_H_ Copyright (c) 2011-2015 Regents of the University of California.
ndnSIM::trie_with_policy< Name, ndnSIM::smart_pointer_payload_traits< EntryImpl< ContentStoreImpl< ndnSIM::multi_policy_traits< boost::mpl::vector2< lru_policy_traits, ndnSIM::lifetime_stats_policy_traits > > > >, Entry >, ndnSIM::multi_policy_traits< boost::mpl::vector2< lru_policy_traits, ndnSIM::lifetime_stats_policy_traits > > > super
super::policy_container::template index< 1 >::type lifetime_stats_container
static TypeId GetTypeId()
virtual void Print(std::ostream &os) const
Print out content store entries.
Special content store realization that provides ability to track stats of CS operations.
Copyright (c) 2011-2015 Regents of the University of California.
ContentStoreImpl< ndnSIM::multi_policy_traits< boost::mpl::vector2< Policy, ndnSIM::lifetime_stats_policy_traits > > > super
Base implementation of NDN content store.
void(* RemoveCsEntryCallback)(Ptr< const Entry >, Time)