Just learning php. Interested in the question of how to find out how quickly a particular function or query to the database is executed. Are there any methods for this language itself or do I need to write / look for an additional utility?
- stackoverflow.com/questions/1200214/… - KoVadim
- And for profiling queries to the database, each database has its own means. Starting with EXPLAIN for MySQL. - PinkTux
- @KoVadim, PinkTux, thank you very much! What you need - Anna Kuimova
|
1 answer
For Sql profiling, you can use explain as it was written to you in the comments; for php functions, you can note the time before the function starts and after the function has completed. If you take more than one script or one request, for example the whole project, you can use Xdebug + KCachegrind https://xdebug.org/docs/profiler https://habrahabr.ru/post/31468/ you can also use memory_get_usage ( http: //php.net/manual/ru/function.memory-get-usage.php ) function and similar to keep track of the used memory
for mysql http://www.profilesql.com/ru/
|