Posted by Jψrn Dahl-Stamnes on 10/10/09 11:57
Kimmo Laine wrote:
> "JΓΈrn Dahl-Stamnes" <newsmanDELETE@REMOVEdahl-stamnes.net> wrote in
> message news:44fc09b5@news.broadpark.no...
>> Hello,
>>
>> When doing queries from MySQL using the mysql client program, I get the
>> time
>> used to get the records at the end of the output.
>>
>> What is the best way of measuring the time used when doing a query from
>> PHP?
>
>
> $started = microtime();
> query();
> $stopped = microtime();
>
> $elapsed = $started - $stopped;
> echo "query took $elapsed ms";
Sounds easy, but it always give me a negative number below 0 (ie -0.15...).
The same query takes 11 seconds in the mysql client.
I'm using php 4.9.3.
--
JΓΈrn Dahl-Stamnes
http://www.dahl-stamnes.net/dahls/
Navigation:
[Reply to this message]
|