Subsecond sleep

2009-10-19 Thread Jed Brown
Barry Smith wrote:
 Likely, it had sleep() in there and a global search and replace wrongly
 turned it into a PetscSleep().

My docs for sleep(3) have:

RETURN VALUE
   Zero if the requested time has elapsed, or the number of seconds left to 
sleep, if the call was interrupted by a signal handler.

Presumably the AIX issue was that sleep() was returning without being
interrupted.  What are the desired semantics for PetscSleep(), I expect
it should return early if interrupted, like POSIX sleep()?  If sleep()
returns early even when not interrupted then I don't see a way for
PetscSleep() to return early if it is interrupted but to go for the full
time otherwise.

 The correct fix is to test properly under AIX, but since no one has AIX
 and it sucks it cannot be tested.

Excellent quote.


Jed

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20091018/f03da2fc/attachment.pgp


Subsecond sleep

2009-10-18 Thread Jed Brown
Barry Smith wrote:
 
   It is fine with me to switch the infrastructure to use a PetscReal
 instead of integer

Done.

http://petsc.cs.iit.edu/petsc/petsc-dev/rev/5704078f5057


Did PetscSleep() once return the time remaining instead of an error
code?  The following can't possibly have worked correctly for a while.
Should it be fixed or removed?

/*
IBM sleep may return at anytime, hence must see if there is more time 
to sleep
*/
{
  int left = sleeptime;
  while (left  0) {left = PetscSleep(left) - 1;}
}



Jed

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20091018/ea43da9b/attachment.pgp


Subsecond sleep

2009-10-16 Thread Jed Brown
I sometimes want to slow down animation with a small problem size and
-draw_pause is generally does what I want, but it can only take integer
arguments and pausing for a whole second every time is often too much.
There are subsecond sleep functions (like usleep and nanosleep) in
POSIX, and I've rolled my own micro-sleep command-line option more than
once now.  Is there a compelling reason not to make -draw_pause and
PetscSleep take a real value, thus offering higher resolution when it is
available?

Jed

-- next part --
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 261 bytes
Desc: OpenPGP digital signature
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20091016/635b5151/attachment.pgp


Subsecond sleep

2009-10-16 Thread Matthew Knepley
No.

  Matt

On Fri, Oct 16, 2009 at 5:02 AM, Jed Brown jed at 59a2.org wrote:

 I sometimes want to slow down animation with a small problem size and
 -draw_pause is generally does what I want, but it can only take integer
 arguments and pausing for a whole second every time is often too much.
 There are subsecond sleep functions (like usleep and nanosleep) in
 POSIX, and I've rolled my own micro-sleep command-line option more than
 once now.  Is there a compelling reason not to make -draw_pause and
 PetscSleep take a real value, thus offering higher resolution when it is
 available?

 Jed




-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-- next part --
An HTML attachment was scrubbed...
URL: 
http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20091016/5a7b6488/attachment.html


Subsecond sleep

2009-10-16 Thread Barry Smith

   It is fine with me to switch the infrastructure to use a PetscReal  
instead of integer

   Barry

On Oct 16, 2009, at 5:02 AM, Jed Brown wrote:

 I sometimes want to slow down animation with a small problem size and
 -draw_pause is generally does what I want, but it can only take  
 integer
 arguments and pausing for a whole second every time is often too much.
 There are subsecond sleep functions (like usleep and nanosleep) in
 POSIX, and I've rolled my own micro-sleep command-line option more  
 than
 once now.  Is there a compelling reason not to make -draw_pause and
 PetscSleep take a real value, thus offering higher resolution when  
 it is
 available?

 Jed