Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Connect forwarder cache hit and miss signals #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 12 additions & 6 deletions utils/tracers/ndn-cs-tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
**/

#include "ndn-cs-tracer.hpp"
#include "fw/forwarder.hpp"
#include "model/ndn-l3-protocol.hpp"
#include "ns3/node.h"
#include "ns3/packet.h"
#include "ns3/config.h"
Expand Down Expand Up @@ -199,10 +201,14 @@ CsTracer::~CsTracer(){};
void
CsTracer::Connect()
{
// // @TODO Do the same with NFD content store...
// Ptr<ContentStore> cs = m_nodePtr->GetObject<ContentStore>();
// cs->TraceConnectWithoutContext("CacheHits", MakeCallback(&CsTracer::CacheHits, this));
// cs->TraceConnectWithoutContext("CacheMisses", MakeCallback(&CsTracer::CacheMisses, this));
auto l3proto = m_nodePtr->GetObject<ndn::L3Protocol>();
auto fwd = l3proto->getForwarder();

fwd->afterCsHit.connect(
[this](Interest interest, Data data) { CacheHits(interest, data); });

fwd->afterCsMiss.connect(
[this](Interest interest) { CacheMisses(interest); });

Reset();
}
Expand Down Expand Up @@ -259,13 +265,13 @@ CsTracer::Print(std::ostream& os) const
}

void
CsTracer::CacheHits(shared_ptr<const Interest>, shared_ptr<const Data>)
CsTracer::CacheHits(const Interest&, const Data&)
{
m_stats.m_cacheHits++;
}

void
CsTracer::CacheMisses(shared_ptr<const Interest>)
CsTracer::CacheMisses(const Interest&)
{
m_stats.m_cacheMisses++;
}
Expand Down
4 changes: 2 additions & 2 deletions utils/tracers/ndn-cs-tracer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ class CsTracer : public SimpleRefCount<CsTracer> {
Connect();

void
CacheHits(shared_ptr<const Interest>, shared_ptr<const Data>);
CacheHits(const Interest&, const Data&);

void
CacheMisses(shared_ptr<const Interest>);
CacheMisses(const Interest&);

private:
void
Expand Down