[Click] click Digest, Vol 35, Issue 4

Ges ges_george at yahoo.com
Sat May 6 12:13:32 EDT 2006


 On Friday 05 May 2006 22:07, Ges wrote:
> I run Click at the same time on both the machines - such that on one the
> transmit element fires initially after 11 secs and on the other after 13
> secs. After that, these elements get rescheduled at an interval of 5 secs.
> But after the first trasmission on both the transmit elements, the
> transmissions start over lapping - for example. at time time + 11 secs -
> Machine 1 transmits
> at time time + 13secs - machine 2 transmits
>
> eveyrthing is fine, no corruption of packets.
>
> now, at time + (11+5) - machine 1 should transmit
> at time time + (13+5) - machine 2 should transmit
>
> but machine one and machine 2 trasmits at (almost) the same time causing
> packet corruption - i tried a larger time gap but that did not help.
>
> The current "time" is synced on both the machines - atleast to a second.
>
> For the initial firing of the timer i use schedule_after_sec(), for
> rescheduing I use reschedule_after_sec() function.
>
Click timers work (almost) perfectly. Most probably the error is in your code. 
(Believe me, I've had this kind of errors a lot)
You should try to debug your timers. A good way to do this is to look at your 
timer's expiry value. Preferably when scheduling it. I always use something 
like this:
click_gettimeofday(now);
click_chatter("At %.9f: timer scheduled in %.9f ms, will expire at %s", 
timeval2double(now), yourexpirylength, timeval2double(timer.expiry()));
(I did not do any syntax checking or compiling on this one)

This tricks will help you to debug those timers. Almost certainly the problem 
is located in your code...

Bart
-----------------------------------------------------------------------------
Hi Bart,

I am going through my code again. I just wanted to clarify something:

The Click timer I am using is used along with a Task. i.e. my timer is created for 
a task: _to_usrp_timer(&_tousrp_task).

I am scheduling the timer and the task alternatively. This is how it works:

I first schedule the timer in the initialization phase of the element. _usrp_timer.schedule_now()
This results in the call to the run_task() function of the element. In run_task() 
I schedule the task twice - _usrp_task.fast_reschedule() which results in another 
call to run_task(), and again _usrp_task.fast_rechedule() is called. After run_task()
runs this time, I schedule the timer to run after X secs. 

Basically, after 2 fast_reschedule of the task(), I schedule the timer to run after X
secs. I am doing this on both the machines. All I vary is the interval X so that the 
transmissions from both do not happen at the same time. 

Does this alternating use confuse the timers? I am not sure, so I thought I should clarify.

Thanks
Gesly
 



More information about the click mailing list