I have a programm of which I want a line-by-line profile with multiple parameter sets. line_profiler does what I want, at least in principle. Basically I want the profile for every parameter set. But I dont get how I could start the line_profiler from within a python script and then analyse the output directly in the same script.
My two problems are: 1) How to start the profiler from within a pythonscript (basically how to emulate the "python kernprof.py -l run.py" call 2) How to get the output of "python -m line_profiler run.py.lprof" into python to get an analysis
Cheers, Andi
take a look to subprocess, something like that should work ;)
proc = subprocess.Popen("whoami", stdout=subprocess.PIPE, shell=True)
(out, err) = proc.communicate()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.