Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Profiling subprocess Popen calls in Python

I have a programm that calls several external scripts by using popen from subprocess. Now I want to profile this programm. While I can easily profile the python code with cProfile I get no information on how long the different external scripts run.

I want to avoid messuring every single popen call with a timer.

Thank you!

like image 447
user1245663 Avatar asked Nov 13 '22 03:11

user1245663


1 Answers

As Simeon said, you just need to write the timing code once. A way to do it would be to decorate the popen function.

like image 153
Charles Brunet Avatar answered Dec 18 '22 10:12

Charles Brunet