Determine how long a system(), pasthrus(), exec(), operation is taking in php
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.
$start = microtime(true);
system(....);
$end = microtime(true);
echo "system() call took ", $end - $start, " microseconds";
For the rest, check out shell_exec() timeout management & exec()
精彩评论