0

Want to know how to determine how long a call to system(), passthru(), exec() (either of these) takes. For example. I use system() to call an external program, I would like to time how long it takes so that if it's taking too long I can kill it or do another operation on it.

si-mikey
  • 183
  • 3
  • 10

1 Answers1

1
$start = microtime(true);
system(....);
$end = microtime(true);

echo "system() call took ", $end - $start, " microseconds";

For the rest, check out shell_exec() timeout management & exec()

Community
  • 1
  • 1
Marc B
  • 356,200
  • 43
  • 426
  • 500
  • This actually gets how long system() took to run. Im looking for a counter of how long system() is taking so while it's still running I can say if it exceeded the time I set to it. – si-mikey Aug 30 '11 at 22:18