comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Duration vs. Ada.Real_Time
Date: 28 Jan 2001 19:32:34 +0000
Date: 2001-01-28T19:32:34+00:00	[thread overview]
Message-ID: <x7vd7d7bhgt.fsf@smaug.pushface.org> (raw)
In-Reply-To: 980495512.529981@edh3

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]

"Atle R�stad" <aer@edh.ericsson.se> 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



  parent reply	other threads:[~2001-01-28 19:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <980495512.529981@edh3>
     [not found] ` <8mac6.9236$R5.473526@news1.frmt1.sfba.home.com>
2001-01-26 15:30   ` Duration vs. Ada.Real_Time Robert Dewar
     [not found] ` <3A71814B.7E8CCF60@acm.org>
2001-01-26 15:33   ` Robert Dewar
2001-01-26 20:58     ` Marin David Condic
2001-01-26 21:32       ` Ted Dennison
2001-01-27  5:01         ` Keith Thompson
2001-01-27 14:40           ` Marin David Condic
2001-01-27 14:34         ` Marin David Condic
2001-01-28  0:18           ` Robert Dewar
2001-01-29 14:54           ` Ted Dennison
2001-01-29 18:40             ` Marin David Condic
2001-02-08  3:32               ` Buz Cory
2001-02-08 15:34                 ` Marin David Condic
2001-02-10  3:08                   ` Steve Whalen
2001-01-28  0:13       ` Robert Dewar
2001-01-29 14:02         ` Marin David Condic
2001-01-30 14:33         ` Stephen Leake
2001-01-31 14:55           ` Marin David Condic
2001-01-31 16:03           ` Ted Dennison
2001-01-31 19:16             ` Marin David Condic
2001-01-31 20:53               ` Ted Dennison
2001-01-31 21:30                 ` tmoran
2001-01-31 21:47                 ` Marin David Condic
2001-02-01 14:18                   ` Ted Dennison
2001-01-28 19:32 ` Simon Wright [this message]
2001-01-31  6:13   ` Robert Dewar
2001-01-31 15:07     ` Marin David Condic
2001-02-01  5:43       ` Robert Dewar
2001-01-31  5:51 Christoph Grein
2001-02-01  6:27 ` Simon Wright
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox