From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,8c3f76cf9b2829c4 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-01-30 12:01:05 PST Path: supernews.google.com!sn-xit-02!sn-xit-01!supernews.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!dispose.news.demon.net!news.demon.co.uk!demon!pogner.demon.co.uk!zap!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Duration vs. Ada.Real_Time Date: 28 Jan 2001 19:32:34 +0000 Organization: CodeFella Message-ID: References: <980495512.529981@edh3> NNTP-Posting-Host: localhost X-NNTP-Posting-Host: pogner.demon.co.uk:158.152.70.98 X-Trace: news.demon.co.uk 980884806 nnrp-14:6809 NO-IDENT pogner.demon.co.uk:158.152.70.98 X-Complaints-To: abuse@demon.net NNTP-Posting-Date: 28 Jan 2001 19:32:34 GMT X-Newsreader: Gnus v5.7/Emacs 20.7 Xref: supernews.google.com comp.lang.ada:4726 Date: 2001-01-28T19:32:34+00:00 List-Id: "Atle R�stad" writes: > Hi > > I have some code that has a max of 30 milliseconds to process, and need to > measure if this is possible. But the requirement for Duration is that > Duration'Small must be less then 20 milliseconds, and > Ada.Real_Time.Time_Unit must be less then 20 microseconds. [...] > I will run the program on an Solaris 8. How will this affect my time > measuring? What resolution can I expect? (1) On Solaris (>=2.6 or so, I think) the default operating system tick is 10 mS. (2) GNAT uses nanosleep() to implement delay (pretty sure of this). (3) nanosleep() sleeps for *at least* the time you specify, rounded up to an integral number of ticks. (4) So, if you "delay 0.000_001;", you'll delay for at least 10 mS and up to 20 mS. However, you can change the OS tick to 1 mS by writing set hires_tick 1 in /etc/system (I may have the exact grammar wrong, mail me at work for the details). This will give you a maximum repetition frequency of 500 Hz. NB, that 1 is a boolean meaning 'true', _not_ the number of milliseconds! Running as root gives you real-time dispatching but doesn't change the behaviour of nanosleep(). Linux is similar, though there's no easy way to change the tick rate (you can edit /usr/include/asm/param.h, or figure a way to redefine HZ, and rebuild the kernel; worked fine for us, but YMMV, though, since the library won't match). And don't try delays < 2 mS as root, they're executed as busy loops. -- Simon Wright Work Email: simon.j.wright@amsjv.com Alenia Marconi Systems Voice: +44(0)23-9270-1778 Integrated Systems Division FAX: +44(0)23-9270-1800