1

I'm pretty sure this has never been asked before, which surprises me a little bit, but if it's a duplicate, please point at the right question :)

We have heavy lag on our servers and I started logging microtime() at various keypoints in our system, but it's still not precise enough and I would like to know the microtime for every single line of code. However this would be an IMMENSE piece of work to do + every file would be double the size + it would be pretty stupid.

So I'd like to know if anyone has any ideas how for example I would set a flag ?log_test=1 in the url for example (with security measures of course) and it would echo microtime() (or anything similar) after each line ending with a semicolon.

I realize this sounds ridiculous, but I'm just wondering if anyone has any ideas of capturing execution time as precise as possible without re-writing the code. We're using CodeIgniter by the way, in case it gives anyone ideas

NaturalBornCamper
  • 3,675
  • 5
  • 39
  • 58
  • *Use a profiler.* That's the tool you're looking for, something that *profiles* your code and gives you a breakdown of all timings. – deceze Jun 27 '17 at 09:31
  • Thanks @deceze! I used profilers in the past for Java, C++ and the Codigniter profiler, but I had no idea you there were run-time server-side profilers for PHP! XDebug sounds good actually, thanks again!! – NaturalBornCamper Jun 27 '17 at 09:43

0 Answers0