note 61669 added to function.sleep

From: Date: Wed, 08 Feb 2006 23:27:50 +0000
Subject: note 61669 added to function.sleep
Groups: php.notes 
Request: Send a blank email to php-notes+get-103340@lists.php.net to get a copy of this message
In regards to sleep being inconsistent, your benchmarks aren't accurate. You add overhead by bundling microtime() into your other function calls. I believe a more accurate benchmark could be obtained using this instead: <?php $t0 = microtime(); sleep(1); $t1 = microtime(); // Make your comparisons here ?> Granted I doubt that sleep() is accurate down to the nanosecond - the function call alone to retrieve the time will take time, and that amount of time may vary depending on the computer it is being run on, number of current processes and their priorities, etc. However, the above code will give you a more accurate representation. -- Josh ---- Server IP: 216.194.113.175 Probable Submitter: 146.6.200.88 ---- Manual Page -- http://www.php.net/manual/en/function.sleep.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61669 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61669&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61669&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103340) next »