Issue connecting with TraceCallback having multiple mixed arguments, double and uint32_t

19 views
Skip to first unread message

Ubaid ur Rahman

unread,
Feb 2, 2017, 3:00:04 AM2/2/17
to ns-3-users
Hello

I have been trying to connect the a trace sink to source, the callback function is not being called I tried the following:

Trace Source of model:
// trace source
TracedCallback<double, double, double, uint32_t> m_utilized;

// In GetTypeId
.AddTraceSource ("UtilizedResources",
                  Trace for utilization",
   MakeTraceSourceAccessor (&NodeUtilization::m_utilized))

void
NodeUtilization::UpdateUtilization()
{
        // defined as class private members
        // double p, ps, ss
        // uint32_t m_nodeId
m_utilized(p, ps, ss, m_nodeId);
}

Trace Sink Class:
Sinker::AttachTraceSink()
{
Config::ConnectWithoutContext("/NodeList/*/$ns3::NodeUtilization/UtilizedResources", MakeCallback(&NodeData::UtilizationSink, this));
}

void
Sinker::UtilizationSink(double p, double ps, double ss, uint32_t nodeId)
{
     NS_LOG_UNCOND("Utilization Sink: \n"<< nodeId << "\n" << p << "%\n" << ps <<"%\n" << ss << "%\n");
}





Tommaso Pecorella

unread,
Feb 4, 2017, 7:59:01 AM2/4/17
to ns-3-users
... and who's calling NodeUtilization::UpdateUtilization ?



T.

Ubaid ur Rahman

unread,
Feb 5, 2017, 2:35:24 AM2/5/17
to ns-3-...@googlegroups.com
Main was calling the Class methods

Ptr<ComputeNode> n = new ComputeNode();

Sinker s;
s.AttachTraceSink();

The issue is now resolved. I was making the same mistake, attaching sink before creating the ComputeNode. 

Thanks for your response :)

--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/0VIkwG0xmA0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+unsubscribe@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.



--
Regards,

Ubaid ur Rahman
Reply all
Reply to author
Forward
0 new messages