Testing feeding of probes

24 views
Skip to first unread message

Alejandro Jimenez

unread,
Sep 1, 2015, 6:51:07 AM9/1/15
to ns-3-users
Dear experts,

I am testing the functionality of probes but I have some questions. In particular I am using the "double-probe-example.cc" to test a probe as ObjectProbe (called case 1).

As it stated in the original example an object is initialized at Time 0.0 because it is not associated with a node, then the "DoInitialize" method is called which schedules method "Count" to make a loop in which "m_counter" (which is linked to the trace source) is increased. As expected, when the variable is modified, the "NotifyViaProbe" fires which means that the probe is recording the changes.

What I am trying to do is to schedule a different event "Count2" (every 1 sec) that also manipulates the variable "m_counter". The problem is that in this way the "NotifyViaProbe" method is NOT firing.

Any comments? Thank you.

Alejandro.
double-probe-example.cc

Alejandro Jimenez

unread,
Sep 9, 2015, 9:45:26 AM9/9/15
to ns-3-users
Hi. I hope someone can help who know what is wrong with my code.

Thanks.

Tom Henderson

unread,
Sep 10, 2015, 1:06:12 AM9/10/15
to ns-3-...@googlegroups.com
I think your problem is that you introduced a second emitter1:

Emitter emitter1;
Ptr<Emitter> emitter = CreateObject<Emitter> ();

and you are mixing the scheduling operations on these two objects:

Simulator::Schedule (Seconds (0.0), &Emitter::Initialize, emitter);

Simulator::Schedule (Seconds (1.0), &Emitter::Count2, &emitter1,
Seconds (1.0));


Emitter1 will probably not work right because it is not being
initialized, and it is not being created by CreateObject(), which means
that it may end up not being fully formed.

Try using CreateObject<>() to create it, and try to initialize it, and
it ought to work.



Reply all
Reply to author
Forward
0 new messages