简体   繁体   中英

How can i benchmark my SQL and PHP code?

I have problems because i don't really know how I can test my code and sql ( mysql ) to see how long SQL queries and PHP functions /code take to run.

Does anyone here know where I can find these tools?

For PHP code, you can use xdebug for profiling . You'll need a frontend to read the trace data as well. If you're on windows, you can use WinCacheGrind . For other OS'es you can use either kCacheGrind (Lots of features, but a bit scary for beginners) or WebGrind (Much simpler and nicer looking).

For Mysql, you can use maatkit for profiling multiple queries, and to analyse a specific query, you should use EXPLAIN .

This is called profiling. XDebug , APD and probably some other packages provide this functionality.

The search keyword you want is " profiler ".

There's several PHP profilers out there; XDebug , PHPEd Profiler , APD , DBG , and PQP , just to name a few.

I've used XDebug on several occasions and though it can be a little annoying to get up and running it does a pretty decent job. Just follow the installations docs and you should be fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM