Add counter for interest and data packets (for performance evaluations)
diff --git a/model/ndn-l3-protocol.cc b/model/ndn-l3-protocol.cc
index 86002e3..372df77 100644
--- a/model/ndn-l3-protocol.cc
+++ b/model/ndn-l3-protocol.cc
@@ -51,9 +51,24 @@
const uint16_t L3Protocol::ETHERNET_FRAME_TYPE = 0x7777;
+uint64_t L3Protocol::s_interestCounter = 0;
+uint64_t L3Protocol::s_dataCounter = 0;
NS_OBJECT_ENSURE_REGISTERED (L3Protocol);
+uint64_t
+L3Protocol::GetInterestCounter ()
+{
+ return s_interestCounter;
+}
+
+uint64_t
+L3Protocol::GetDataCounter ()
+{
+ return s_dataCounter;
+}
+
+
TypeId
L3Protocol::GetTypeId (void)
{
@@ -240,6 +255,7 @@
{
case HeaderHelper::INTEREST:
{
+ s_interestCounter ++;
Ptr<InterestHeader> header = Create<InterestHeader> ();
// Deserialization. Exception may be thrown
@@ -255,6 +271,7 @@
}
case HeaderHelper::CONTENT_OBJECT:
{
+ s_dataCounter ++;
Ptr<ContentObjectHeader> header = Create<ContentObjectHeader> ();
static ContentObjectTail contentObjectTrailer; //there is no data in this object
diff --git a/model/ndn-l3-protocol.h b/model/ndn-l3-protocol.h
index 25dfd39..40278d6 100644
--- a/model/ndn-l3-protocol.h
+++ b/model/ndn-l3-protocol.h
@@ -134,6 +134,12 @@
virtual Ptr<Face>
GetFaceByNetDevice (Ptr<NetDevice> netDevice) const;
+ static uint64_t
+ GetInterestCounter ();
+
+ static uint64_t
+ GetDataCounter ();
+
private:
void
Receive (const Ptr<Face> &face, const Ptr<const Packet> &p);
@@ -155,6 +161,9 @@
uint32_t m_faceCounter; ///< \brief counter of faces. Increased every time a new face is added to the stack
FaceList m_faces; ///< \brief list of faces that belongs to ndn stack on this node
+ static uint64_t s_interestCounter;
+ static uint64_t s_dataCounter;
+
// These objects are aggregated, but for optimization, get them here
Ptr<Node> m_node; ///< \brief node on which ndn stack is installed
Ptr<ForwardingStrategy> m_forwardingStrategy; ///< \brief smart pointer to the selected forwarding strategy