Adding more statistics collection (number of transmitted/received bytes
per "pit entry" and per face)
diff --git a/utils/load-stats-face.cc b/utils/load-stats-face.cc
index 56701e4..53edb6a 100644
--- a/utils/load-stats-face.cc
+++ b/utils/load-stats-face.cc
@@ -42,6 +42,8 @@
m_count.Step ();
m_satisfied.Step ();
m_unsatisfied.Step ();
+ m_tx.Step ();
+ m_rx.Step ();
}
struct update_retval
@@ -92,6 +94,8 @@
m_count += load.m_count;
m_satisfied += load.m_satisfied;
m_unsatisfied += load.m_unsatisfied;
+ m_tx += load.m_tx;
+ m_rx += load.m_rx;
return *this;
}
@@ -99,7 +103,7 @@
bool
LoadStatsFace::IsZero () const
{
- return m_count.IsZero () && m_satisfied.IsZero () && m_unsatisfied.IsZero ();
+ return m_count.IsZero () && m_satisfied.IsZero () && m_unsatisfied.IsZero () && m_tx.IsZero () && m_rx.IsZero ();
}
struct print_tuple
diff --git a/utils/load-stats-face.h b/utils/load-stats-face.h
index 6c85a68..a930181 100644
--- a/utils/load-stats-face.h
+++ b/utils/load-stats-face.h
@@ -49,6 +49,18 @@
inline const LoadStats&
unsatisfied () const;
+
+ inline LoadStats&
+ tx ();
+
+ inline const LoadStats&
+ tx () const;
+
+ inline LoadStats&
+ rx ();
+
+ inline const LoadStats&
+ rx () const;
//
LoadStats::stats_tuple
@@ -67,6 +79,8 @@
LoadStats m_count;
LoadStats m_satisfied;
LoadStats m_unsatisfied;
+ LoadStats m_rx;
+ LoadStats m_tx;
friend std::ostream &
operator << (std::ostream &os, const LoadStatsFace &stats);
@@ -96,6 +110,23 @@
LoadStatsFace::unsatisfied () const
{ return m_unsatisfied; }
+inline LoadStats&
+LoadStatsFace::tx ()
+{ return m_tx; }
+
+inline const LoadStats&
+LoadStatsFace::tx () const
+{ return m_tx; }
+
+inline LoadStats&
+LoadStatsFace::rx ()
+{ return m_rx; }
+
+inline const LoadStats&
+LoadStatsFace::rx () const
+{ return m_rx; }
+
+
std::ostream &
operator << (std::ostream &os, const LoadStatsFace &stats);
diff --git a/utils/load-stats-node.cc b/utils/load-stats-node.cc
index 59184c8..e64bb9d 100644
--- a/utils/load-stats-node.cc
+++ b/utils/load-stats-node.cc
@@ -113,6 +113,21 @@
}
}
+void
+LoadStatsNode::Rx (ns3::Ptr<ns3::CcnxFace> face, uint32_t amount)
+{
+ m_pit.rx () += amount;
+ m_incoming [face].rx () += amount;
+}
+
+void
+LoadStatsNode::Tx (ns3::Ptr<ns3::CcnxFace> face, uint32_t amount)
+{
+ m_pit.tx () += amount;
+ m_outgoing [face].tx () += amount;
+}
+
+
LoadStatsNode &
LoadStatsNode::operator += (const LoadStatsNode &stats)
{
diff --git a/utils/load-stats-node.h b/utils/load-stats-node.h
index e91b094..9bdf5be 100644
--- a/utils/load-stats-node.h
+++ b/utils/load-stats-node.h
@@ -76,6 +76,18 @@
void
Timeout ();
+ /**
+ * Increment counter for Tx amount
+ */
+ void
+ Rx (ns3::Ptr<ns3::CcnxFace> face, uint32_t amount);
+
+ /**
+ * Increment counter for Tx amount
+ */
+ void
+ Tx (ns3::Ptr<ns3::CcnxFace> face, uint32_t amount);
+
LoadStatsNode &
operator += (const LoadStatsNode &stats);
diff --git a/utils/load-stats.cc b/utils/load-stats.cc
index 66786fd..2fca525 100644
--- a/utils/load-stats.cc
+++ b/utils/load-stats.cc
@@ -62,13 +62,18 @@
LoadStats &
LoadStats::operator ++ (int)
{
- // NS_LOG_FUNCTION (this);
-
counter_ ++;
return *this;
}
LoadStats &
+LoadStats::operator += (uint32_t amount)
+{
+ counter_ += amount;
+ return *this;
+}
+
+LoadStats &
LoadStats::operator += (const LoadStats &stats)
{
// NS_LOG_FUNCTION (this << &stats << stats.counter_);
diff --git a/utils/load-stats.h b/utils/load-stats.h
index 0b03ce5..abd09a0 100644
--- a/utils/load-stats.h
+++ b/utils/load-stats.h
@@ -51,6 +51,9 @@
LoadStats &
operator += (const LoadStats &stats);
+ LoadStats &
+ operator += (uint32_t amount);
+
stats_tuple
GetStats () const;
diff --git a/utils/stats-tree.cc b/utils/stats-tree.cc
index 6d2ff28..e987043 100644
--- a/utils/stats-tree.cc
+++ b/utils/stats-tree.cc
@@ -87,6 +87,22 @@
item.first->payload ().Timeout ();
}
+void
+StatsTree::Rx (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face, uint32_t amount)
+{
+ std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
+
+ item.first->payload ().Rx (face, amount);
+}
+
+void
+StatsTree::Tx (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face, uint32_t amount)
+{
+ std::pair<tree_type::iterator, bool> item = m_tree.insert (key, LoadStatsNode ());
+
+ item.first->payload ().Tx (face, amount);
+}
+
// const LoadStatsNode &
// StatsTree::Get (const ns3::CcnxNameComponents &key) const
const LoadStatsNode &
diff --git a/utils/stats-tree.h b/utils/stats-tree.h
index 1f9d146..9702675 100644
--- a/utils/stats-tree.h
+++ b/utils/stats-tree.h
@@ -55,6 +55,12 @@
void
Timeout (const ns3::CcnxNameComponents &key);
+ void
+ Rx (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face, uint32_t amount);
+
+ void
+ Tx (const ns3::CcnxNameComponents &key, ns3::Ptr<ns3::CcnxFace> face, uint32_t amount);
+
// const LoadStatsNode &
// Get (const ns3::CcnxNameComponents &key) const;
const LoadStatsNode &