Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!pcrat!rick From: rick@pcrat.uucp (Rick Richardson) Newsgroups: comp.windows.x Subject: Re: XtAddTimeOut() and Timed Interrupts. Message-ID: <1990Aug25.171200.8440@pcrat.uucp> Date: 25 Aug 90 17:12:00 GMT References: <9008231943.AA01202@crc.skl.dnd.ca> <141292@sun.Eng.Sun.COM> Reply-To: rick@pcrat.UUCP (Rick Richardson) Organization: PC Research, Inc., Tinton Falls, NJ Lines: 57 In article <141292@sun.Eng.Sun.COM> argv@turnpike.Eng.Sun.COM (Dan Heller) writes: >In article <9008231943.AA01202@crc.skl.dnd.ca> jgraham@CRC.SKL.DND.CA (Jay Graham) writes: >> We are developing an application on 386/ix and will need time >> interrupts in the 10s of milleseconds range, however when using >> XtAddTimeOut() with a 10ms interval we seem to be actually getting >> around a 20ms interval. We assume that maybe there are communication >Don't try to develop something similar -- this is the best resolution >you're going to get, all things considered. XtAddTimeOut() is closely >tied to the select() system call. On 386/ix, the STREAMS function poll() takes an argument in milliseconds, but the actual resolution is 10 msecs. I don't know what the select() function uses, since I can't find any documentation for it. I haven't any knowledge of which one 386/ix uses for X, but my guess is that it isn't poll, since you should be able to get down to 10 msecs. Here is a little test program you can use to check the resolution of poll(). Usage: polltest msecs. The test should take 10 seconds unless you specify an msecs value smaller than the resolution allowed. -Rick #include #include #include #include #include #define SECS 10 /* * Test program to verify timeout resolution of poll(2) * Usage: polltest [ timeout_in_msecs ] */ main(argc, argv) char *argv[]; { struct tms tms_dummy; struct pollfd poll_dummy; int i, msecs, ticks; long start, end; msecs = (argc > 1) ? atoi(argv[1]) : 10; ticks = (SECS*1000)/msecs; start = times(&tms_dummy); for (i = 0; i < ticks; ++i) poll(&poll_dummy, 0, msecs); end = times(&tms_dummy); printf("%d sec. test took %f secs.\n", SECS, ((float) end-start)/HZ); } -- Rick Richardson | Looking for FAX software for UNIX/386 ??? Ask About: |Mention PC Research,Inc.| FaxiX - UNIX Facsimile System (tm) |FAX# for uunet!pcrat!rick| FaxJet - HP LJ PCL to FAX (Send WP,Word,Pagemaker...)|Sample (201) 389-8963 | JetRoff - troff postprocessor for HP LaserJet and FAX|Output