> > 1. If you want precision, it would slow down your code a lot, as > basically you need to record timing of each opcode, which can be very > expensive.
I'm not too concerned about the cost as this would only be running locally and the for the purpose of profiling. The proviso with this would be that the costs associated didn't reflect in the line profile time and skew the results. Stackoverflow question http://stackoverflow.com/q/1113034/214196 has > the link to some profiling tool that seems to do line-level, but from the > fact > they mention PHP 4 support I'm not sure how up-to-date it is. I will be sure to check it out - thanks. > Not sure what you mean by "parsing the file correctly" - PHP engine does > the parsing, profiler shouldn't do any parsing. By this I mean I have looked at implementing it a couple of different ways and each time I get caught up on timing code that spans multiple lines such as: $array = array( 'my_key' => 'my_value', ); Where I want to measure the variable assignment however because it spans multiple lines I can't work out the best way to include it all. 'Parsing' is probably the incorrect term here but it's all that came to mind when writing this :p I've implemented a basic sampling profiler with line-level resolution some > time ago: https://github.com/nikic/sample_prof Thanks a bunch! I will check it out and see if I can get it working for what I am after.