views:

194

answers:

3

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?

+1  A: 

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

Ignas R
Xbebug i don't like it, its not soe good to bechmark i ges, :/ i dont know APD.
NeoNmaN
@NeoNmaN Out of curiosity, what don't you like about xdebug's profiler?
Mike B
A: 

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.

fiXedd
i have read about PQP before but i dont understand to make it to work, :/
NeoNmaN
+5  A: 

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.

troelskn