Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > Hi Xiaoyan,
- >
- > The "policy" that I was talking about is just a way to get access to the
- > underlying data structure (insert/erase events).
- >
- > In any case, as it could be a generally useful metric, I decided to
- > implement the necessary mechanics myself. If you're curious, you can
- > check commit 8566f458f2aacc25f06683ce00219f7168ee71f5, in particular
- > utils/trie/lifetime-stats-policy.h policy file.
- >
- > As of right now (commit f4a0359ac1dc60390ea41d8347c73a8c24a6789e) you can
- > use the following code in order to get samples for lifetime of cached
- > entries (copy from http://ndnsim.net/helpers.html#content-store):
- >
- > --------------------
- > void
- > CacheEntryRemoved (std::string context, Ptr<const ndn::cs::Entry> entry,
- > Time lifetime)
- > {
- > std::cout << entry->GetName () << " " << lifetime.ToDouble (Time::S)
- > << "s" << std::endl;
- > }
- > ...
- > ndnHelper.SetContentStore ("ns3::ndn::cs::Stats::Lru", "MaxSize", "10000");
- > ...
- > ndnHelper.Install (nodes);
- > // connect to lifetime trace
- > Config::Connect ("/NodeList/*/$ns3::ndn::cs::Stats::Lru/WillRemoveEntry",
- > MakeCallback (CacheEntryRemoved));
- > --------------------
- >
- > I haven't had time, but you can write a tracer (similar to the one you
- > already wrote for CacheHits/CacheMisses), which will make tracing totally
- > trivial.
- >
- > Please note, that you *have to* use a specialized version of content store
- > (ns3::ndn::cs::Stats::Lru, ns3::ndn::cs::Stats::Random, or
- > ns3::ndn::cs::Stats::Fifo), and
- > Config::Connect/Config::ConnectWithoutContext *have to* specify the correct
- > content store implementation.
- >
- > Another note, for some replacement policies, entries may not be put in
- > cache at all. In the current implementation, such entries will be reported
- > with lifetime 0.
- >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement