Finalizing PathWeight tracing
Now tracing is moved to CcnxConsumer
diff --git a/helper/ccnx-trace-helper.cc b/helper/ccnx-trace-helper.cc
index 303d1aa..f5df0cb 100644
--- a/helper/ccnx-trace-helper.cc
+++ b/helper/ccnx-trace-helper.cc
@@ -370,7 +370,7 @@
NS_LOG_FUNCTION (this);
m_pathWeightsTrace = new ofstream (pathWeights.c_str (), ios::trunc);
- WindowTracer::PrintHeader (*m_pathWeightsTrace);
+ CcnxPathWeightTracer::PrintHeader (*m_pathWeightsTrace);
*m_pathWeightsTrace << "\n";
}
diff --git a/helper/tracers/ccnx-path-weight-tracer.cc b/helper/tracers/ccnx-path-weight-tracer.cc
index d1cb709..4d6aa7d 100644
--- a/helper/tracers/ccnx-path-weight-tracer.cc
+++ b/helper/tracers/ccnx-path-weight-tracer.cc
@@ -27,6 +27,7 @@
#include "ns3/ccnx-app.h"
#include "ns3/ccnx-face.h"
#include "ns3/boolean.h"
+#include "ns3/simulator.h"
#include <boost/lexical_cast.hpp>
#include <boost/foreach.hpp>
@@ -57,25 +58,38 @@
Config::Set ("/NodeList/"+m_node+"/$ns3::CcnxL3Protocol/ForwardingStrategy/MetricTagging",
BooleanValue (true));
- Config::Connect ("/NodeList/"+m_node+"/$ns3::CcnxL3Protocol/FaceList/*/$ns3::CcnxLocalFace/PathWeightsTrace",
+ Config::Connect ("/NodeList/"+m_node+"/ApplicationList/"+m_appId+"/PathWeightsTrace",
MakeCallback (&CcnxPathWeightTracer::InLocalFace, this));
+ // Config::Connect ("/NodeList/"+m_node+"/$ns3::CcnxL3Protocol/FaceList/*/$ns3::CcnxLocalFace/PathWeightsTrace",
+ // MakeCallback (&CcnxPathWeightTracer::InLocalFace, this));
}
void
-CcnxPathWeightTracer::PrintHeader (std::ostream &os) const
+CcnxPathWeightTracer::PrintHeader (std::ostream &os)
{
- os << "Node\t"
- << "AppId\t"
- << "PathWeight\t"
- << "PathWeights\n";
+ os << "Time\t"
+ << "Src\t"
+ << "Dst\t"
+ << "SeqNo\t"
+ << "Weight";
}
void
CcnxPathWeightTracer::InLocalFace (std::string context,
- uint32_t weight, Ptr<Node> src, Ptr<Node> dst)
+ Ptr<Node> src, Ptr<Node> dst, uint32_t seqno, uint32_t weight)
{
- std::cout << "Path weights from " << Names::FindName (src) << " to "<< Names::FindName (dst) <<" : " << weight << "\n";
+ std::string srcName = Names::FindName (src);
+ std::string dstName = Names::FindName (dst);
+ if (srcName == "") srcName = boost::lexical_cast<std::string> (src->GetId ());
+ if (dstName == "") srcName = boost::lexical_cast<std::string> (dst->GetId ());
+ // std::cout << "Path weights from " << Names::FindName (src) << " to "<< Names::FindName (dst) <<" : " << weight << "\n";
+
+ m_os << Simulator::Now ().ToDouble (Time::S) << "\t"
+ << srcName << "\t"
+ << dstName << "\t"
+ << seqno << "\t"
+ << weight << "\n";
}
} // namespace ns3
diff --git a/helper/tracers/ccnx-path-weight-tracer.h b/helper/tracers/ccnx-path-weight-tracer.h
index ca43a5d..868e61f 100644
--- a/helper/tracers/ccnx-path-weight-tracer.h
+++ b/helper/tracers/ccnx-path-weight-tracer.h
@@ -41,15 +41,15 @@
void
Connect ();
- virtual void
- PrintHeader (std::ostream &os) const;
+ static void
+ PrintHeader (std::ostream &os);
/**
* \brief Process packet weight upon reception of packet on a local face
*/
virtual void
InLocalFace (std::string context,
- uint32_t weight, Ptr<Node> src, Ptr<Node> dst);
+ Ptr<Node> src, Ptr<Node> dst, uint32_t seqno, uint32_t weight);
protected:
std::ostream &m_os;