Page 1 of 1
mySQL Query Execution Timer?
Posted: Sun Oct 17, 2004 4:07 pm
by MattF
I was just wondering if there was a way of doing this any neater than microtime() + time() before and after and comparing? I noticed in phpMyAdmin they have a query timer, anyone know how that's done?
Posted: Sun Oct 17, 2004 4:57 pm
by feyd
tried looking in their code?
Posted: Sun Oct 17, 2004 5:03 pm
by MattF
I haven't, that's a good idea

Posted: Sun Oct 17, 2004 5:22 pm
by mudkicker
if you find it how, can you post an example code or explain us?

Posted: Sun Oct 17, 2004 6:43 pm
by kettle_drum
phpMyAdmin does use microtime to work out how long the query took:
sql.php
Code: Select all
// garvin: Measure query time. TODO-Item http://sourceforge.net/tracker/index.ph ... tid=377411
list($usec, $sec) = explode(' ',microtime());
$querytime_before = ((float)$usec + (float)$sec);
$result = @PMA_mysql_query($full_sql_query);
list($usec, $sec) = explode(' ',microtime());
$querytime_after = ((float)$usec + (float)$sec);
$GLOBALS['querytime'] = $querytime_after - $querytime_before;
Posted: Sun Oct 17, 2004 7:20 pm
by mudkicker
oh, the old-fashioned way..
Posted: Mon Oct 18, 2004 1:47 am
by MattF
Thanks
