In my code (based on ns3.19) I do sthg like:
===
Ptr<OutputStreamWrapper> streamRxNext = asciiTraceHelper.CreateFileStream (prefix+"_RxNext.csv");
NS_ASSERT(sock->m_rxBuffer.TraceConnect ("NextRxSequence", "NextRxSequence", MakeBoundCallback(&dumpNextTxSequence, streamRxNext)));
===
and when I launch the script:
====
1 ObjectBase:TraceConnect(): Could not find accessor for NextRxSequence
assert failed. cond="sock->m_rxBuffer.TraceConnect ("NextRxSequence", "NextRxSequence", MakeBoundCallback(&dumpNextTxSequence, streamRxAvailable))", file=../src/internet/model/mp-tcp-subflow.cc, line=1605
terminate called without an active exception
===
Any idea as to why it does not find the accessor even though it should exist see:
===
TcpRxBuffer::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::TcpRxBuffer")
.SetParent<Object> ()
.AddConstructor<TcpRxBuffer> ()
.AddTraceSource ("NextRxSequence",
"Next sequence number expected (RCV.NXT)",
MakeTraceSourceAccessor (&TcpRxBuffer::m_nextRxSeq))
===
Regards
std::endl sends a newline character '\n' and flushes the output buffer. '\n' sends the newline character, but does not flush the output buffer.NS_ASSERT(sock->m_txBuffer.TraceConnect ("UnackSequence", "UnackSequence", MakeBoundCallback(&dumpNextTxSequence, streamTx)));
TypeId
TcpTxBuffer::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::TcpTxBuffer")
.SetParent<Object> ()
.AddConstructor<TcpTxBuffer> ()
.AddTraceSource ("UnackSequence",
"First unacknowledged sequence number (SND.UNA)",
MakeTraceSourceAccessor (&TcpTxBuffer::m_firstByteSeq))
;
return tid;
}
TypeId:TypeId(0x7fffde935b80, 202)
TypeId:TypeId(0x7fffde935ae0, ns3::TcpTxBuffer)
TypeId:AllocateUid(0x7fa223c81580, ns3::TcpTxBuffer)
TypeId:SetParent(0x7fffde935ae0, TypeId:GetName(0x7fffde9358c0)
TypeId:GetName(0x7fa223c81580, 2)
TypeId:LookupInformation(0x7fa223c81580, 2)
ns3::Object)
TypeId:SetParent(0x7fa223c81580, 274, 2)
TypeId:LookupInformation(0x7fa223c81580, 274)
TypeId:DoAddConstructor(0x7fffde935af0, 0x7fffde935a90)
TypeId:AddConstructor(0x7fa223c81580, 274, 0x7fffde935900)
TypeId:LookupInformation(0x7fa223c81580, 274)
TypeId:AddTraceSource(0x7fffde935b00, UnackSequence, First unacknowledged sequence number (SND.UNA), 0x23d0ef0)
TypeId:AddTraceSource(0x7fa223c81580, 274, UnackSequence, First unacknowledged sequence number (SND.UNA), 0x23d0ef0)
TypeId:LookupInformation(0x7fa223c81580, 274)
TypeId:HasTraceSource(0x7fa223c81580, 274, UnackSequence)
TypeId:LookupInformation(0x7fa223c81580, 274)
TypeId:LookupInformation(0x7fa223c81580, 2)
TypeId:LookupInformation(0x7fa223c81580, 3)
TypeId:LookupInformation(0x7fa223c81580, 3)
TypeId:GetParent(0x7fffde935b70)
TypeId:GetParent(0x7fa223c81580, 274)
TypeId:LookupInformation(0x7fa223c81580, 274)Starting research !!
0s -1 TypeId:LookupTraceSourceByName(0x7fffde934760, UnackSequence)
0s -1 TypeId:GetTraceSourceN(0x7fffde934760)
0s -1 TypeId:GetTraceSourceN(0x7fa223c81580, 2)
0s -1 TypeId:LookupInformation(0x7fa223c81580, 2)
GetTraceSourceN ()0
0s -1 TypeId:GetTraceSourceN(0x7fffde934580)
0s -1 TypeId:GetTraceSourceN(0x7fa223c81580, 2)
0s -1 TypeId:LookupInformation(0x7fa223c81580, 2)
0s -1 TypeId:GetParent(0x7fffde934580)
0s -1 TypeId:GetParent(0x7fa223c81580, 2)
0s -1 TypeId:LookupInformation(0x7fa223c81580, 2)
0s -1 TypeId:TypeId(0x7fffde9345c0, 3)
0s -1 TypeId:GetTraceSourceN(0x7fffde934760)
0s -1 TypeId:GetTraceSourceN(0x7fa223c81580, 2)
0s -1 TypeId:LookupInformation(0x7fa223c81580, 2)
GetTraceSourceN ()0
0s -1 TypeId:GetTraceSourceN(0x7fffde934580)
0s -1 TypeId:GetTraceSourceN(0x7fa223c81580, 3)
0s -1 TypeId:LookupInformation(0x7fa223c81580, 3)
0s -1 TypeId:GetParent(0x7fffde934580)
0s -1 TypeId:GetParent(0x7fa223c81580, 3)
0s -1 TypeId:LookupInformation(0x7fa223c81580, 3)
0s -1 TypeId:TypeId(0x7fffde9345c0, 3)
-1 ObjectBase:TraceConnect(): Could not find accessor for UnackSequence
assert failed. cond="sock->m_txBuffer.TraceConnect ("UnackSequence", "UnackSequence", MakeBoundCallback(&dumpNextTxSequence, streamTx))"I still can't figure why I am not able to trace "UnackSequence":NS_ASSERT(sock->m_txBuffer.TraceConnect ("UnackSequence", "UnackSequence", MakeBoundCallback(&dumpNextTxSequence, streamTx)));
So I ran ns3 with NS_LOG += ":TypeId" # to look for AddTraceSource
to notice that the TraceSource was never registered !!TypeId
TcpTxBuffer::GetTypeId (void)
{
static TypeId tid = TypeId ("ns3::TcpTxBuffer")
.SetParent<Object> ()
.AddConstructor<TcpTxBuffer> ()
.AddTraceSource ("UnackSequence",
"First unacknowledged sequence number (SND.UNA)",
MakeTraceSourceAccessor (&TcpTxBuffer::m_firstByteSeq))
;
return tid;
}
You've got to insert at the beginning of tcp-tx-buffer.h this line:
NS_OBJECT_ENSURE_REGISTERED (TcpTxBuffer);
TypeId:SetParent(0x7fb2e5df7580, 274, 2)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:DoAddConstructor(0x7fff0549a430, 0x7fff0549a3d0)
TypeId:AddConstructor(0x7fb2e5df7580, 274, 0x7fff0549a240)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:AddTraceSource(0x7fff0549a440, NextRxSequence, Next sequence number expected (RCV.NXT), 0x6c0ed0)
TypeId:AddTraceSource(0x7fb2e5df7580, 274, NextRxSequence, Next sequence number expected (RCV.NXT), 0x6c0ed0)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:HasTraceSource(0x7fb2e5df7580, 274, NextRxSequence)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:LookupInformation(0x7fb2e5df7580, 2)
TypeId:LookupInformation(0x7fb2e5df7580, 3)
TypeId:LookupInformation(0x7fb2e5df7580, 3)
Registering NextRxSequence" with uid="274"
TypeId:AddTraceSource(0x7fff0549a450, RxTotal, Size of all packets in receive buffer , 0x6c0e60)
TypeId:AddTraceSource(0x7fb2e5df7580, 274, RxTotal, Size of all packets in receive buffer , 0x6c0e60)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:HasTraceSource(0x7fb2e5df7580, 274, RxTotal)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:LookupInformation(0x7fb2e5df7580, 2)
TypeId:LookupInformation(0x7fb2e5df7580, 3)
TypeId:LookupInformation(0x7fb2e5df7580, 3)
Registering RxTotal" with uid="274"
TypeId:AddTraceSource(0x7fff0549a460, RxAvailable, Size of all packets in receive buffer , 0x6b4ef0)
TypeId:AddTraceSource(0x7fb2e5df7580, 274, RxAvailable, Size of all packets in receive buffer , 0x6b4ef0)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:HasTraceSource(0x7fb2e5df7580, 274, RxAvailable)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:LookupInformation(0x7fb2e5df7580, 2)
TypeId:LookupInformation(0x7fb2e5df7580, 3)
TypeId:LookupInformation(0x7fb2e5df7580, 3)
Registering RxAvailable" with uid="274"
TypeId:GetParent(0x7fff0549a530)
TypeId:GetParent(0x7fb2e5df7580, 274)
TypeId:LookupInformation(0x7fb2e5df7580, 274)
TypeId:TypeId(0x7fff0549a540, 2)
TypeId:TypeId(0x7fff0549a4a0, ns3::TcpTxBuffer)
TypeId:AllocateUid(0x7fb2e5df7580, ns3::TcpTxBuffer)
TypeId:SetParent(0x7fff0549a4a0, TypeId:GetName(0x7fff0549a280)
TypeId:GetName(0x7fb2e5df7580, 2)
TypeId:LookupInformation(0x7fb2e5df7580, 2)
ns3::Object)
TypeId:SetParent(0x7fb2e5df7580, 275, 2)bool
ObjectBase::TraceConnect (std::string name, std::string context, const CallbackBase &cb)
{
NS_LOG_FUNCTION (this << name << context << &cb);
TypeId tid = GetInstanceTypeId ();
NS_LOG_UNCOND( "GetInstanceTypeId=" << tid);
Ptr<const TraceSourceAccessor> accessor = tid.LookupTraceSourceByName (name);
if (accessor == 0)
{
NS_LOG_WARN("Could not find accessor for " << name);
return false;
}
bool ok = accessor->Connect (this, context, cb);
return ok;
}