I'm not sure if there is direct function for this, but to keep it simple, i would do microtime() before and after query and do subtraction
Simple way to do it is $starttime = microtime(); $query = mysql_query("select * from table"); $endtime = microtime();
Remember though this time wont be a constant for a query and will depend on caching. For worst case time, flush and perform this