How to get the memory usage of a script that runs via symfony-process?

  php, profiling, symfony, symfony-process

So, here’s this wep-app, happily running python scripts, queued via messages, with the Symfony Process component:

$stopwatch = new Stopwatch();
$stopwatch->start('cmd');

$process = new Process($somePythonCmd, null, ['PYENV_VERSION' => 'unicornenv']);
$process->start();
$process->wait();

$event = $stopwatch->stop('cmd');
$metrics = [
    'duration' => Helper::formatTime($event->getDuration() / 1000),
    'memory' => Helper::formatMemory($event->getMemory())
];

I think this measures the memory consumption of the PHP process itself, right?

Is there a way to measure the actual memory usage of the python script?

Source: Ask PHP

LEAVE A COMMENT