Re: [PHP4] gettimeofday()
| From: | Remco Chang | Date: | Mon, 07 Aug 2000 17:20:14 +0000 |
| Subject: | Re: [PHP4] gettimeofday() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-10506@lists.php.net to get a copy of this message | ||
no, it's a stand-alone linux box (e-machine) with one processor (intel
pIII).
----------------
remco chang
bountyquest.com
On Mon, 7 Aug 2000, Rasmus Lerdorf wrote:
> Interesting. What sort of box is this? SMP?
>
> -Rasmus
>
> On Mon, 7 Aug 2000, Remco Chang wrote:
>
> > hi,
> >
> > i've been testing out the performance of php4 with apache and odbc driver
> > (oob by easysoft.com) using gettimeofday() to find the amount of elapsed
> > time... i'm running php4.0.1pl2 on redhat 6.2 with apache 1.3.12.
> >
> > the problem that i'm having is that gettimeofday seems to return time that
> > "jumps backwards in time." here's an example of what i would get when i
> > write a for loop to grab the current time ten thousand times:
> >
> > time: 965666189.9983
> > time: 965666189.99903
> > time: 965666189.99976
> > time: 965666181.00049 **********
> > time: 965666181.00123
> > time: 965666181.00197
> >
> > note that this does not happen all the time... i would say in 10,000
> > times, this happens about 5 times or so. also note that strange enough,
> > it always seems to jump backwards 9 seconds percisely... *boggle*
> >
> > i wrote a small program in c to test the <sys/time.h> gettimeofday()
> > function to make sure that it's not a hardware issue, and it's not. :)
> >
> > does any one know if this is a problem with apache, php, or a combination
> > of the two? is this a bug or is it due to some "smart forking" that php
> > does to optimize for loops?
> >
> > thanx in advance for any help!
> >
> > attached is the program i wrote for testing:
> >
> > <?php
> >
> > function getCurrentTime () {
> > $time_array = gettimeofday();
> > return $time_array["sec"] + ($time_array["usec"]/100000);
> > }
> >
> > $cache_time = 0;
> > $cur_time = 0;
> >
> > echo "test starts...";
> >
> > for ($i=0; $i<10000; $i++) {
> > $cur_time = getCurrentTime();
> > echo "<br>time: $cur_time";
> > if ($cur_time < $cache_time) { //if time starts going backwards
> > echo " **********";
> > }
> > $cache_time = $cur_time;
> > }
> >
> > ?>
> >
> >
> > ----------------
> > remco chang
> > bountyquest.com
> >
> >
> >
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>