pcp
[Top] [All Lists]

Re: Review: PCP & pmlogger take too long to start

To: Michael Newton <kimbrr@xxxxxxx>
Subject: Re: Review: PCP & pmlogger take too long to start
From: Nathan Scott <nscott@xxxxxxxxxx>
Date: Thu, 28 Jun 2007 12:02:07 +1000
Cc: pcp@xxxxxxxxxxx
In-reply-to: <Pine.SGI.4.58.0706271715321.2351218@xxxxxxxxxxxxxxxxxxxxxxx>
Organization: Aconex
References: <Pine.SGI.4.58.0706271012280.2186626@xxxxxxxxxxxxxxxxxxxxxxx> <Pine.SGI.4.58.0706271124250.2186626@xxxxxxxxxxxxxxxxxxxxxxx> <Pine.SGI.4.58.0706271715321.2351218@xxxxxxxxxxxxxxxxxxxxxxx>
Reply-to: nscott@xxxxxxxxxx
Sender: pcp-bounce@xxxxxxxxxxx
On Wed, 2007-06-27 at 18:00 +1000, Michael Newton wrote:
> ...
> 
> +# got usleep ?
> +SLEEPCMND=`which usleep 2>/dev/null | $PCP_AWK_PROG '
> +BEGIN          { i = 0 }
> +/ not in /     { i = 1 }
> +/ aliased to /  { i = 1 }
> +               { if ( i == 0 ) print }and
> +'`
> +if [ -z "$SLEEPCMND" ]
> +then
> +    SLEEPCMND="sleep 1"
> +    SLEEPINTVL=10      #tenths of a sec
> +else
> +    SLEEPINTVL=1       #tenths of a sec
> +    SLEEPCMND="$SLEEPCMND 100000"
> +fi 

Repeating this in so many scripts is a bit of a shame, and it'd be
better if they were faster always (not just is usleep found).  We
should implement a "pmsleep" command (like we did for pmhostname)
if we want this sub-second sleeper on all platforms (which we do)
... its trivial, just use nanosleep(), which is POSIX and is there
on all supported PCP platforms.

I still haven't found a usleep on Debian (what package is that in
on your SuSE/RH boxen?), and its not there on MacOSX, so I doubt
its there on Windows/Cygwin.

The other alternative is that sleep(1) seems to allow sub-second
sleeping these days (I've only tried the GNU tools) - but that's
not standard, so we'll probably get bitten by using that.

cheers.


<Prev in Thread] Current Thread [Next in Thread>