logging - PHP - measuring database time for a HTTP request -


i want find how time php http request spends in database. rails logger prints out such information (how time spent on rendering, database , app). example:

completed in 0.01224 (81 reqs/sec) | db: 0.00044 (3%) | 302 found [http://localhost/posts] 

is there similar php too?

thanks in advance.

you can use microtime() , memory_get_usage() test speed memory used (which more important orm's).

$time = microtime(true); $memory = memory_get_usage();  ...code here...  print (microtime(true)-$time). ' seconds , '. (memory_get_usage()-$memory). ' bytes'; 

however, database queries should benchmarked @ database level. use mysql query profiler real benchmarking.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -