Re: waittime function precision

Jevgeni Astanovski <[email protected]>
Newsgroups gmane.comp.lang.as400.c
Message-ID <[email protected]>
I tried what you said (_WAIT_MPL_SET)
Results are pretty similar:
Delay = 10 ms, waittime: 18.480 ms 
Delay = 20 ms, waittime: 38.960 ms 
Delay = 30 ms, waittime: 59.432 ms 
Delay = 40 ms, waittime: 52.360 ms 
Delay = 50 ms, waittime: 69.720 ms 
Delay = 60 ms, waittime: 89.440 ms 
Delay = 70 ms, waittime: 69.824 ms 
Delay = 80 ms, waittime: 91.824 ms 
Delay = 90 ms, waittime: 119.128 ms

Actually I do not expect that waittime is somewhat precise in milliseconds range - at least I see it isn't.
If you tell her to wait for a minute, you probably do not care about +/- 20ms!

But is there something that works reasonably in a milliseconds range?


-----Original Message-----
From: c400-l-bounces-Zwy7GipZuJhWk0Htik3J/[email protected] [mailto:c400-l-bounces-Zwy7GipZuJhWk0Htik3J/[email protected]] On Behalf Of Buck Calabro
Sent: Tuesday, April 15, 2014 8:21 PM
To: c400-l-Zwy7GipZuJhWk0Htik3J/[email protected]
Subject: Re: [C400-L] waittime function precision

On 4/15/2014 7:04 AM, Jevgeni Astanovski wrote:

> I've used waittime function for pretty long time in cases, where I needed to have a delay in my program.
> But recently a question appeared - how precise it is and are there any alternatives that allow to make delays for less than 1/100 of a second.

I think this is expected behaviour for waittime().  I always understood waittime to guarantee a minimum delay, not to guarantee a precise delay.

_WAIT_NORMAL sets all bits off, so
  Access state control = no explicit transfer of PAG
  MPL control = remove thread from multiprogramming level
  Async signals = Not allowed

Judging from this, it seems like there would be some time the processor spends swapping the thread into and out of the MPL.  It would be interesting to try this on a dedicated machine, and also with _WAIT_MPL_SET rather than _WAIT_NORMAL.

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Frzatk%2FWAITTIME.htm

  --buck
--
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected] To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.

-- 
This is the Bare Metal Programming IBM i (AS/400 and iSeries) (C400-L) mailing list
To post a message email: C400-L-Zwy7GipZuJhWk0Htik3J/[email protected]
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/c400-l
or email: C400-L-request-Zwy7GipZuJhWk0Htik3J/[email protected]
Before posting, please take a moment to review the archives
at http://archive.midrange.com/c400-l.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.