Enabling TCP window tracing (there is a trick to do it with
Config::Connect, see examples/congestion-pop.cc)
There was a bug with InFlight interest calculation
diff --git a/helper/tracers/ccnx-consumer-window-tracer.cc b/helper/tracers/ccnx-consumer-window-tracer.cc
index e2bf877..eea664a 100644
--- a/helper/tracers/ccnx-consumer-window-tracer.cc
+++ b/helper/tracers/ccnx-consumer-window-tracer.cc
@@ -32,53 +32,55 @@
using namespace boost;
namespace ns3 {
-
-CcnxConsumerWindowTracer::CcnxConsumerWindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId)
+
+void
+CcnxConsumerWindowTracer::Connect ()
+{
+ Config::Connect ("/NodeList/"+m_node+"/ApplicationList/"+m_appId+"/$ns3::CcnxConsumerWindow/WindowTrace",
+ MakeCallback (&WindowTracer::OnWindowChange, this));
+}
+
+void
+TcpCongestionWindowTracer::Connect ()
+{
+ Config::Connect ("/NodeList/"+m_node+"/$ns3::TcpL4Protocol/SocketList/*/CongestionWindow",
+ MakeCallback (&WindowTracer::OnWindowChange, this));
+}
+
+
+WindowTracer::WindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId)
: m_appId (appId)
, m_nodePtr (node)
, m_os (os)
{
m_node = boost::lexical_cast<string> (m_nodePtr->GetId ());
- Connect ();
-
string name = Names::FindName (node);
if (!name.empty ())
{
- m_node = name;
+ m_nodeName = name;
}
-}
-
-void
-CcnxConsumerWindowTracer::Connect ()
-{
- Config::Connect ("/NodeList/"+m_node+"/ApplicationList/"+m_appId+"/$ns3::CcnxConsumerWindow/WindowTrace",
- MakeCallback (&CcnxConsumerWindowTracer::OnWindowChange, this));
+ else
+ m_nodeName = m_node;
}
void
-CcnxConsumerWindowTracer::PrintHeader (std::ostream &os) const
+WindowTracer::PrintHeader (std::ostream &os)
{
os << "Time\t"
<< "Node\t"
<< "AppId\t"
<< "Window";
}
-
-void
-CcnxConsumerWindowTracer::Print (std::ostream &os) const
-{
- // do nothing
-}
void
-CcnxConsumerWindowTracer::OnWindowChange (std::string context,
- uint32_t oldValue, uint32_t newValue)
+WindowTracer::OnWindowChange (std::string context,
+ uint32_t oldValue, uint32_t newValue)
{
m_os
<< Simulator::Now ().ToDouble (Time::S) << "\t"
- << m_node << "\t"
+ << m_nodeName << "\t"
<< m_appId << "\t"
<< newValue << endl;
}
diff --git a/helper/tracers/ccnx-consumer-window-tracer.h b/helper/tracers/ccnx-consumer-window-tracer.h
index b178ee1..c538931 100644
--- a/helper/tracers/ccnx-consumer-window-tracer.h
+++ b/helper/tracers/ccnx-consumer-window-tracer.h
@@ -28,41 +28,49 @@
class Node;
-class CcnxConsumerWindowTracer : public SimpleRefCount<CcnxConsumerWindowTracer>
+class WindowTracer : public SimpleRefCount<WindowTracer>
{
public:
- CcnxConsumerWindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*");
- virtual ~CcnxConsumerWindowTracer () { };
-
- void
- Connect ();
-
- virtual void
- PrintHeader (std::ostream &os) const;
+ WindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*");
+ virtual ~WindowTracer () { };
+
+ static void
+ PrintHeader (std::ostream &os);
virtual void
- Print (std::ostream &os) const;
-
- virtual void
OnWindowChange (std::string context,
uint32_t oldValue, uint32_t newValue);
protected:
std::string m_appId;
std::string m_node;
+ std::string m_nodeName;
Ptr<Node> m_nodePtr;
std::ostream& m_os;
};
-inline std::ostream&
-operator << (std::ostream &os, const CcnxConsumerWindowTracer &tracer)
+class CcnxConsumerWindowTracer : public WindowTracer
{
- os << "# ";
- tracer.PrintHeader (os);
- os << "\n";
- tracer.Print (os);
- return os;
-}
+public:
+ CcnxConsumerWindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*")
+ : WindowTracer (os, node, appId)
+ { Connect (); }
+
+ void
+ Connect ();
+};
+
+class TcpCongestionWindowTracer : public WindowTracer
+{
+public:
+ TcpCongestionWindowTracer (std::ostream &os, Ptr<Node> node, const std::string &appId = "*")
+ : WindowTracer (os, node, appId)
+ { Connect (); }
+
+ void
+ Connect ();
+};
+
} // namespace ns3