Re: [PHP-DEV] Interesting sleep() side-effect From: Tom May (tom <email protected>)
Date: 01/27/99

Rasmus Lerdorf <rasmus <email protected>> writes:

> In testing Thies' connection abort detection code, completely unrelated to
> his stuff, I noticed an interesting side-effect of calling sleep() in a
> PHP script. I have tried this on both Linux and Solaris and get the same
> results. Could you guys with access to other OS'es try this one?
>
> <?
> set_time_limit(5);
> register_shutdown_function("done");
> function done() {
> global $i;
>
> $fp = fopen("/tmp/done","w");
> fputs($fp,"i reached $i\n");
> fclose($fp);
> }
>
> for($i=0; $i<30000; $i++) {
> for($j=0;$j<1000;$j++) $a=sqrt($j);
> /* sleep(1); */
> echo "$i ................................................................................<br>";
> flush();
> }
> ?>
>
>
> This script should run for 5 seconds,

setitimer(ITIMER_PROF, ...) measures CPU time, not real time.

Tom.

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>