[Freeswitch-users] CONFIG_HZ=1000 vs mod_timerfd -- preferred approach

Jayanth Acharya jayachar88 at gmail.com
Thu Aug 29 12:42:46 MSD 2013


On Thu, Aug 29, 2013 at 1:28 PM, Peter Olsson <peter at olssononline.se> wrote:

>
> I believe that timerfd is used automatically in the core if it detects a
> system supporting it. However, I don't know how to really be sure.. :) One
> thing though, if you just startup FS, if it doesn't try to do clock
> calibration during startup, I think it is using timerfd stuff, so that
> might be a way to "know"...
>
> Also, when running FS, you can try timer_test command (inside FS console)
> and check out the results in there.
>

Thanks Peter.

freeswitch at dabbian1> timer_test 10 3
2013-08-29 13:56:24.703028 [CONSOLE] mod_commands.c:827 Timer Test: 1 sleep
10 10019
2013-08-29 13:56:24.712967 [CONSOLE] mod_commands.c:827 Timer Test: 2 sleep
10 9930
2013-08-29 13:56:24.722996 [CONSOLE] mod_commands.c:827 Timer Test: 3 sleep
10 10040

Avg: 9.996ms Total Time: 29.989ms

However,  for the "time_test" command in Mod_commands Wiki page -- I see
that it assumes units as "microseconds" (not milliseconds, which is usually
what we mean by "ms").. or is it a typo ??

*... bad timer jitter is. It runs the test count times (default 10) and
tries to sleep for mss microseconds. It returns the actual timer duration
along with an average.
*

Anyhow, not sure how to interpret if the output of timer_test indicates a
healthy resolution or not.

/Peter
>
>
> 2013/8/29 Jayanth Acharya <jayachar88 at gmail.com>
>
>> Thanks Jeff. Reading the mod_timerfd wiki page, I see that there are 2
>> approaches to using timerfd,
>>
>> 1. Using the loadable module i.e. mod_timerfd (requiring me to build this
>> module and then ensure it is loaded)
>> 2. Using the support of timerfd now available in FS core itself
>> (requiring me to just enable it in the switch.conf file)
>>
>> By default neither of those 2 seem to be true. I am on what as the Git
>> HEAD last week - 22nd Aug 2013, so pretty recent source. However, it when I
>> adopted the 2nd approach, i.e. enable timerfd use in FS core, by enabling
>> the config in switch.conf, it didn't have the desired effect. Perhaps
>> indicating that my problems might not be limited to just the timer
>> resolution !!
>>
>> Using the method described here:
>> http://www.advenage.com/topics/linux-timer-interrupt-frequency.php
>>
>> I tested and found that on my FS machine, the timer resolution available
>> is already pretty good -- in the ~3KHz range, so shouldn't be an issue, if
>> FS core is indeed correctly using timerfd.
>>
>> ---
>> kernel timer interrupt frequency is approx. 3401 Hz
>> jayachar at dabbian1:~$ ./timer_resolution_test
>> kernel timer interrupt frequency is approx. 3401 Hz
>> jayachar at dabbian1:~$ ./timer_resolution_test
>> kernel timer interrupt frequency is approx. 3448 Hz
>> jayachar at dabbian1:~$ ./timer_resolution_test
>> kernel timer interrupt frequency is approx. 3021 Hz
>> jayachar at dabbian1:~$ ./timer_resolution_test
>> kernel timer interrupt frequency is approx. 3067 Hz
>> ---
>>
>> I have already check that my kernel has the TIMERFD option enabled in the
>> build, which explains (perhaps) the ~3KHz resolution I see.
>>
>> So the question now is, is FS really using the timerfd logic in it's core
>> properly, or do I need to try the mod_timerfd method as well !! (That's a
>> rhetorical question... I will go ahead and try anyway, disabling the FS
>> core option to use timerfd, as per the Wiki).
>>
>>
>>
>> On Thu, Aug 29, 2013 at 11:21 AM, Jeff Leung <jleung at v10networks.ca>wrote:
>>
>>> If I can recall correctly, timerfd will be used automatically regardless
>>> in recent versions of FreeSWITCH if it’s available.****
>>>
>>> ** **
>>>
>>> *From:* freeswitch-users-bounces at lists.freeswitch.org [mailto:
>>> freeswitch-users-bounces at lists.freeswitch.org] *On Behalf Of *Jayanth
>>> Acharya
>>> *Sent:* Wednesday, August 28, 2013 9:35 PM
>>> *To:* FreeSWITCH Users Help
>>> *Subject:* [Freeswitch-users] CONFIG_HZ=1000 vs mod_timerfd --
>>> preferred approach****
>>>
>>> ** **
>>>
>>> Assuming that one has full control over the kernel configuration and FS
>>> build / config options, is there a preferred mechanism between the 2 for
>>> letting FS have access to high resolution timers, i.e.****
>>>
>>>    - CONFIG_HZ=1000****
>>>    - mod_timerfd****
>>>
>>> This was one step I missed in my FS setup, and I think it might explain
>>> the extremely choppy, broken, garbled announcement I hear when I call into
>>> my gsmopen EP via phone.****
>>>
>>> J****
>>>
>>> _________________________________________________________________________
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
> 
> 
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20130829/f7582276/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list