[Click] Patch for nanosecond scheduling precision in ns-3-click

Lalith Suresh suresh.lalith at gmail.com
Wed Jan 25 15:41:44 EST 2012


On Wed, Jan 25, 2012 at 9:40 PM, Eddie Kohler <ekohler at gmail.com> wrote:
> Hi Lalith,
>
> This is fair enough. But we could add a sim-command that returned 0 if the
> current timestamp is a timespec. On Ns-2 this command would return -1. Then
> we could do what's appropriate within click.
>

Alright. I'll have an update ready soon.

> Eddie
>
>
>
> On 1/9/12 3:33 PM, Lalith Suresh wrote:
>>
>> Hi Eddy,
>>
>> On Mon, Jan 9, 2012 at 7:05 PM, Eddie Kohler<ekohler at gmail.com>  wrote:
>>>
>>> Hi Lalith,
>>>
>>> This change looks generally good, but surely ns defines some version
>>> variables that we can use to detect whether "cursimnode->curtime" is a
>>> timespec or a timeval. If it doesn't, then please add one: #define
>>> NS_CURTIME_IS_TIMESPEC 1. Then Click can be made to work cleanly with
>>> either, for instance:
>>>
>>> #if NS_CURTIME_IS_TIMESPEC
>>>  *ts = cursimnode->curtime;
>>> #else
>>>  ts->tv_sec = cursimnode->curtime.tv_sec;
>>>  ts->tv_nsec = cursimnode->curtime.tv_usec * 1000;
>>> #endif
>>>
>>> The timer scheduling code in routerthread.cc would also need a fork: #if
>>> CLICK_NS&&  NS_CURTIME_IS_TIMESPEC /timespec-code/ #elif CLICK_NS
>>> /timeval-code/ #endif.
>>>
>>> Make sense?
>>>
>>
>> Nopes (or I'm way too tired). :)
>>
>> I don't think a #define in ns-3 will help here. ns-3 links with
>> libnsclick.so dynamically, and "cursimnode->curtime" comes from
>> include/click/simclick.h (struct simclick_node). If we are to use the
>> preprocessor to fork the code appropriately, then we'd need to know
>> NS_CURTIME_IS_TIMESPEC during Click's compile time. Right?
>>
>>> Sascha, did you end up trying this?
>>> Eddie
>>>
>>>
>>>
>>> On 12/31/11 7:46 AM, Lalith Suresh wrote:
>>>>
>>>>
>>>> Hello all,
>>>>
>>>> After Sascha raised this issue on the ns-3-users list [1], I tried
>>>> making a quick patch to make Click's NS code use timespec, and make
>>>> the corresponding changes on the ns-3 side as well.
>>>>
>>>> I've pushed the changes to my ns-3-click [2] and Click [3]
>>>> repositories. Kindly review. I'll push to ns-3-dev once the Click side
>>>> changes are applied. Note that this will probably break the ns-2
>>>> patches for nsclick.
>>>>
>>>>
>>>> [1]
>>>>
>>>> http://groups.google.com/group/ns-3-users/browse_thread/thread/2be8d60531bd82a8
>>>> [2] http://code.nsnam.org/lalith/ns-3-click-dev
>>>> [3] https://github.com/lalithsuresh/click
>>>>
>>>
>>
>>
>>
>



-- 
Lalith Suresh
www.lalith.in



More information about the click mailing list