In PHP, is there a way I can capture what the CPU usage is of each ImagaMagick/GraphicsMagick method I execute? Memory usage would be nice, too.
Basically, I'm trying to benchmark how much resources each library uses in my application.
Failed attempt:
exec('convert a.jpg a.png');
$result = array();
// Loop until process is detected
do
{
exec('ps -eo comm,%cpu,%mem | grep ' . "convert", $result);
}
while($result === array());
// Display the changing CPU and memory usage of the process
do
{
print_r($result);
exec('ps -eo comm,%cpu,%mem | grep ' . "convert", $result);
}
while($result !== array());