Question PAUSE statement doesn't seem to work fine

Saran

New Member
Hi Team,
I came across with issue on PAUSE statement today. I know its not a major concern, but am bit suprized to see Progress working this way. In the below example i expect my ETIME to be always greater than 5000 which promises me PAUSE 5 statement really pauses for 5 seconds; (Or is it something to do with ETIME)

ETIME(YES).
PAUSE 5.
MESSAGE ETIME VIEW-AS ALERT-BOX.

In most of the cases this gives a value > 5000 which is fine, but in some random cases it gives me less than 5000 which seems to suggest PAUSE 5 is not exactly 5 seconds but may be little lesser or higher. Am i missing out something here?

Regards,
Saravanakumar B
 

Cringer

ProgressTalk.com Moderator
Staff member
I seem to remember that PAUSE uses processor cycles to measure time, and therefore isn't completely accurate. I could be completely wrong though. lol
 

Saran

New Member
Ohh, interesting! Thanks Cringer... If in case i get more details, will drop a post on this thread.
 

TomBascom

Curmudgeon
PAUSE sets an alarm to wake up the process after the interval expires. It does not do a "busy loop" until the time is reached. This is easy to see -- while paused a process consumes no CPU time. Use your favorite system monitoring tool to see that.

The system call used is nap() or sleep() or some variation (you could also dig in to the specifics of that using sysinternals on windows or truss/trace on UNIX). Those calls have a some uncertainty because the OS operates at a certain granularity so there can be some "fuzziness" around the exact time consumed. The etime() function also has some uncertainty, mtime() is more precise if you really want to go crazy ;)
 
Top