-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Tue, 4 Nov 2003 15:18:00 +0200, Gilad Ben-Yossef <[EMAIL PROTECTED]> wrote: > > On Tuesday 04 November 2003 14:43, Ehud Karni wrote: > > > I tested the select call on various machines. > > 1. It is not accurate enough (2 ms deviations). > > Yes it does, you don't seem to use sched_setscheduler in your test program to > give your proccess real time priority. setpriority only changes the nice > level of the proccess. If you want real time guantees (which you do here) you > need to ask the kernel to subject your proccess to real time scheduling.
See test results below. > > 2. It can not be used for delays < 10 ms. > > Unless you recompile the kernel, you are correct. I enhanced my test program by adding the scheduler priority like this: #include <sched.h> struct sched_param scd_prm ; scd_prm.sched_priority = 10 ; /* anything greater than 0 */ sched_setscheduler ( 0 , SCHED_RR , & scd_prm ) ; /* try to set scheduler policy and priority */ setpriority ( PRIO_PROCESS , 0 , atoi ( argv [ 2 ] ) ) ;/* set nice priority (no check) */ fprintf ( stderr , "Run at %d sched priority, %d nice " , sched_getscheduler ( 0 ) , /* get schedule priority */ getpriority ( PRIO_PROCESS , 0 ) ) ; /* get process priority */ I tested the select sleep and my conclusions are: 1. Even with Real time priority it is accurate to within 0.1 mill seconds (see 1st set of results). 2. The granularity is 10 ms even for times > 10 ms. Here are some of the results: Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3995 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3995 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3998 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 4000 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3992 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3993 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3995 msecs Run at 2 sched priority, -20 nice sleeped 1 usec * 100 times, Elapsed 997 msecs Run at 2 sched priority, -20 nice sleeped 38 usec * 100 times, Elapsed 991 msecs Run at 2 sched priority, -20 nice sleeped 987 usec * 100 times, Elapsed 1000 msecs Run at 2 sched priority, -20 nice sleeped 1987 usec * 100 times, Elapsed 992 msecs Run at 2 sched priority, -20 nice sleeped 9876 usec * 100 times, Elapsed 1000 msecs Run at 2 sched priority, -20 nice sleeped 19876 usec * 100 times, Elapsed 1997 msecs Run at 2 sched priority, -20 nice sleeped 18076 usec * 100 times, Elapsed 1995 msecs Run at 2 sched priority, -20 nice sleeped 19076 usec * 100 times, Elapsed 1991 msecs Run at 2 sched priority, -20 nice sleeped 37076 usec * 100 times, Elapsed 3999 msecs Run at 2 sched priority, -20 nice sleeped 36076 usec * 100 times, Elapsed 3994 msecs Run at 2 sched priority, -20 nice sleeped 35076 usec * 100 times, Elapsed 3993 msecs Run at 2 sched priority, -20 nice sleeped 34076 usec * 100 times, Elapsed 3998 msecs Run at 2 sched priority, -20 nice sleeped 33076 usec * 100 times, Elapsed 3997 msecs Run at 2 sched priority, -20 nice sleeped 32076 usec * 100 times, Elapsed 3993 msecs Run at 2 sched priority, -20 nice sleeped 31076 usec * 100 times, Elapsed 3993 msecs Run at 2 sched priority, -20 nice sleeped 30076 usec * 100 times, Elapsed 3993 msecs Run at 2 sched priority, -20 nice sleeped 29076 usec * 100 times, Elapsed 2998 msecs Run at 2 sched priority, -20 nice sleeped 29976 usec * 100 times, Elapsed 2994 msecs Ehud. - -- Ehud Karni Tel: +972-3-7966-561 /"\ Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign Insurance agencies (USA) voice mail and X Against HTML Mail http://www.mvs.co.il FAX: 1-815-5509341 / \ GnuPG: 98EA398D <http://www.keyserver.net/> Better Safe Than Sorry -----BEGIN PGP SIGNATURE----- Comment: use http://www.keyserver.net/ to get my key (and others) iD8DBQE/qOYBLFvTvpjqOY0RAqs0AJ9PszCyABgW2GS4Xq0X7nZ5yOHWjgCfTtap OgFidx/1HGIC12IIghyG8Ro= =laIM -----END PGP SIGNATURE----- ================================================================= To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]