0

You may wonder why I would want to do this. I'm trying to debug PHP performance on an embedded system. Don't have access to any kind of tools on the device.

I was thinking if I could just do a simple microseconds calculation on every call, it would work.

Is there a way to do it? Essentially wrap all of my functions (not built in php).

This wouldn't be for production of course.

Charlie
  • 1,646
  • 5
  • 22
  • 40

1 Answers1

0

You can use declare(ticks=1000); to run an callback, like:

// you can use this:
declare(ticks=1);

// A function called on each tick event
function tick_handler()
{
    debug_backtrace();//get function name
    microtime();//get time
}

http://www.php.net/declare

you only have to get the right number e.g. 1000 for your tests cycles

JOUM
  • 239
  • 1
  • 3