Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-06-07 Thread Steve Kann

Gilad Ben-Yossef wrote:


Derek Smithies wrote:



Does anyone have some realworld experience on a recent machine & 
software timers to prove they are still a bad idea?




Fact of life - on a 2.4 Linux kernel for x86 or PPC the timer 
resolution is 10ms (look for the HZ macro in 
/usr/src/linux/include/asm/param.h) That's simply not enough.



Not enough for what?  What do you need to do that 10ms resultion isn't 
enough?


-SteveK



___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-dev


Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-06-07 Thread Gilad Ben-Yossef

Derek Smithies wrote:



Does anyone have some realworld experience on a recent machine & software 
timers to prove they are still a bad idea?




Fact of life - on a 2.4 Linux kernel for x86 or PPC the timer resolution 
is 10ms (look for the HZ macro in /usr/src/linux/include/asm/param.h) 
That's simply not enough.


2.6 is a whole different kettle of fish.

Gilad



--
Gilad Ben-Yossef <[EMAIL PROTECTED]>
Codefidence. A name you can trust(tm)
Web: http://codefidence.com  | SIP: [EMAIL PROTECTED]
IL: +972.9.8650475 ext. 201  | Fax:+972.9.8850643
US: +1.360.2275194 ext. 201  | Cel:   +972.52.8260388

"I am Jack's Overwritten Stack Pointer"
-- Hackers Club, the movie
___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-dev


Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-05-27 Thread David Woodhouse
On Sat, 2005-05-28 at 10:56 +1200, Derek Smithies wrote:
> Does anyone have some realworld experience on a recent machine & software 
> timers to prove they are still a bad idea?

Anyone using ztdummy on a 2.6 kernel is using precisely the same
software timers which drive the kernel's POSIX timer support.

-- 
dwmw2

___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev


Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-05-27 Thread Derek Smithies
Hi,
 
> >software timers are lacking.
> >  
> >
> 
> I think that is just narrow thinking.

Steve's original link for why software timers are a bad idea  was from 2002.

Since then we have had fantastic improvements in 
  a) cpu performance
  b) latency of the kernel 
 - anyone tried the low latency kernel & software times?
  c) the overall kernel code.

I think it is a reasonable question then:
 Are software timers still a bad idea?


Does anyone have some realworld experience on a recent machine & software 
timers to prove they are still a bad idea?

Derek

-- 
Derek Smithies Ph.D. 
IndraNet Technologies Ltd.
Email: [EMAIL PROTECTED] 
ph +64 3 365 6485  
Web: http://www.indranet-technologies.com/  

___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev


Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-05-27 Thread Andrew Kohlsmith
On May 27, 2005 12:32 pm, Tilghman Lesher wrote:
> On Friday 27 May 2005 05:33, David Woodhouse wrote:
> > Using zaptel just for a time source is silly. We should use POSIX
> > timers instead. Here's a start, but I don't know how long it'll be
> > before I can get to finish it, so I thought I'd post it here in the
> > hope that someone else will pick it up.
>
> As noted here:
>
> http://lists.digium.com/pipermail/asterisk-users/2002-April/002072.html
>
> software timers are lacking.

That link doesn't have *any* information whatsoever on why.  1000Hz should be 
trivial to generate on a PC.  hell I was doing this back in the DOS days with 
the PIT.  Granted things have changed a bit since then but I hardly think 
that a crystal oscillator on a PCI chipset *designed* to be as cheap as 
humanly possible is "great precision" as the link indicates.  :-)

-A.
___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev


Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-05-27 Thread Steve Kann

Tilghman Lesher wrote:


On Friday 27 May 2005 05:33, David Woodhouse wrote:
 


Using zaptel just for a time source is silly. We should use POSIX
timers instead. Here's a start, but I don't know how long it'll be
before I can get to finish it, so I thought I'd post it here in the
hope that someone else will pick it up.
   



As noted here:

http://lists.digium.com/pipermail/asterisk-users/2002-April/002072.html

software timers are lacking.
 



I think that is just narrow thinking.

app_conference works all day and week long, without any hardware 
support.  It also does it without posix timers.  It just uses nanosleep 
and gettimeofday.


You can make things go X times per second, with great accuracy over a 
long period of time with just those tools.  What you can't always do is 
make sure that you don't have a period where you oversleep for a few ten 
of milliseconds.  But if you keep track of time, you can just do more 
work when you do wake up.



i.e.  in pseudo-code

do_something_n_times_per_second(func_t something, int n) {
   long now, last, begin = getcurrentmillis();

   last = begin;  


   for(;;) {
   usleep(n);
   time now = getcurrentmillis();  
   while(last < now) {

something();
last+=n;
   }
   }  


}


where getcurrentmillis() can be based on gettimeofday, of course.

This will call something() 1000/n times per second. It might not be 
spaced out so that it happens _exactly_ every n ms, but it will, over a 
particular time period, happen 1000/n times per second.


If this runs in a real-time process, and the something() takes less than 
n ms to run, it will happen very close to every  n ms.


Of course, most things don't need to run every ms, and this will work 
better when n>1.


-SteveK



___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
  http://lists.digium.com/mailman/listinfo/asterisk-dev


Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-05-27 Thread Andrew Thompson

Tilghman Lesher wrote:

On Friday 27 May 2005 05:33, David Woodhouse wrote:

Using zaptel just for a time source is silly. We should use POSIX
timers instead. Here's a start, but I don't know how long it'll be
before I can get to finish it, so I thought I'd post it here in the
hope that someone else will pick it up.



As noted here:

http://lists.digium.com/pipermail/asterisk-users/2002-April/002072.html

software timers are lacking.


Call me slow, or just a user, but I don't understand your response. I 
can't tell if you're agreeing with David's post, or not.


I read the link, it's to a brainstorm about using USB as a timing source.

Is that the "software timer" that's lacking, or is it the POSIX 
implementation you're referring to?


/me says "huh?"

--
Andrew Thompson
http://aktzero.com/
begin:vcard
fn:Andrew Thompson
n:Thompson;Andrew
email;internet:[EMAIL PROTECTED]
x-mozilla-html:FALSE
url:http://aktzero.com/
version:2.1
end:vcard

___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev

Re: [Asterisk-Dev] High resolution timers using POSIX clocks instead of zaptel

2005-05-27 Thread Tilghman Lesher
On Friday 27 May 2005 05:33, David Woodhouse wrote:
> Using zaptel just for a time source is silly. We should use POSIX
> timers instead. Here's a start, but I don't know how long it'll be
> before I can get to finish it, so I thought I'd post it here in the
> hope that someone else will pick it up.

As noted here:

http://lists.digium.com/pipermail/asterisk-users/2002-April/002072.html

software timers are lacking.

-- 
Tilghman
___
Asterisk-Dev mailing list
Asterisk-Dev@lists.digium.com
http://lists.digium.com/mailman/listinfo/asterisk-dev
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev