mySQL Query Execution Timer?
Moderator: General Moderators
mySQL Query Execution Timer?
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?
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
phpMyAdmin does use microtime to work out how long the query took:
sql.php
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;