[Asterisk-bsd] MeetMe drift

David Greenman-Lawrence dg228 at dglawrence.com
Sun Jul 29 06:03:40 CDT 2007


> > On Fri, 27 Jul 2007 17:10:07 -0700, David G Lawrence wrote:
> >    Attached is a slightly improved version of my ztdummy.c that should
> > work if system HZ is larger than 1000.
> 
> I appreciate your help with this problem.  FWIW here are some zttest
> results with and without your patch:

> Normal zaptel:
> 
> # ( zttest > zttest.txt & ); sleep 300; killall -INT zttest; tail -2 zttest.txt
> --- Results after 292 passes ---
> Best: 100.000000 -- Worst: 98.449707 -- Average: 99.935727
> 
> With your ztdummy.c:
> 
> # ( zttest > zttest.txt & ); sleep 300; killall -INT zttest; tail -2 zttest.txt
> --- Results after 292 passes ---
> Best: 99.694824 -- Worst: 99.328613 -- Average: 99.529350

   Hi, Corey. As I mentioned previously, the very short term accuracy of my
ztdummy.c (1 second or less) is very good, but not perfect. PC timers just
don't allow for that. With HZ=1000, the error that will result is 1ms of
jitter, so short term tests will show the accuracy number as less than
perfect. The problem there is actually with the test program, not the
timer. :-) 1ms of jitter in 1 second will not be a problem with packet
voice (in fact anything better than 10ms is as good as perfect).
 
> Digium says zttest should report > 99.98 for there not to be timing issues.

   Digium is wrong. :-) ...or at least their conclusion is based on an
incorrect assumption - that short term and long term timer accuracy are
the same, which would be the case with a Zaptel hardware timer, but not
in the case where 1ppt corrections are periodically applied (as in my
ztdummy).
   The numbers reported by zttest are misleading and wrong, at least when
measuring a timer that has 100% long term accuracy, but just "very good"
sub-second accuracy.
   Let me illustrate. The accuracy of zttest.c's results can be improved
by a factor of 10 with the following patch:

*** zttest.c.orig	Sun Jul 29 03:35:28 2007
--- zttest.c	Sun Jul 29 03:36:03 2007
***************
*** 8,14 ****
  #include <sys/signal.h>
  #include <math.h>
  
! #define SIZE 8000
  
  static int pass = 0;
  static float best = 0.0;
--- 8,14 ----
  #include <sys/signal.h>
  #include <math.h>
  
! #define SIZE 80000
  
  static int pass = 0;
  static float best = 0.0;
***************
*** 30,36 ****
  	int ms;
  	int curarg = 1;
  	int verbose=0;
! 	char buf[8192];
  	float score;
  	struct timeval start, now;
  	fd = open("/dev/zap/pseudo", O_RDWR);
--- 30,36 ----
  	int ms;
  	int curarg = 1;
  	int verbose=0;
! 	char buf[SIZE];
  	float score;
  	struct timeval start, now;
  	fd = open("/dev/zap/pseudo", O_RDWR);

   With this you'll get results like this with my ztdummy:

Opened pseudo zap interface, measuring accuracy...
99.987640% 99.976517% 99.982697% 99.976517% 99.919647% 99.978989% 99.978989% 
99.978989% 99.976517% 99.918411% 99.986404% 99.972801% 99.986404% 99.974037%
99.920883% 99.982697% 99.977753% 99.982697% 99.975273% 99.917175% 99.975273%
99.981461% 99.978989% 99.980225% 99.915939% 99.978989% ^C
--- Results after 26 passes ---
Best: 99.987640 -- Worst: 99.915939 -- Average: 99.967764

   ...and if you change SIZE above to 800000 (and have a lot of patience -
it will take several minutes to get the first number :-)), you'll get
something like this:

Opened pseudo zap interface, measuring accuracy...
99.994133% 99.995750% 99.993378% ^C
--- Results after 3 passes ---
Best: 99.995750 -- Worst: 99.993378 -- Average: 99.994425


-DG

David Greenman-Lawrence
President
Download Technologies, Inc. - http://www.downloadtech.com - (866) 399 8500
Co-Founder, The FreeBSD Project - http://www.freebsd.org
Pave the road of life with opportunities.



More information about the Asterisk-BSD mailing list