Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kernprof (line_profiler): how to output result as text instead of a binary file

When running kernprof:

kernprof -l script_to_profile.py

The output is stored in a binary file, which can be read in the terminal/command line.

Is there a way to output the results to a text file?

This seems like useful functionality to have, but can't find it in the documentation or in other posts.

like image 511
PvK Avatar asked Oct 29 '25 07:10

PvK


1 Answers

python -m line_profiler script_to_profile.py.lprof > profile_output.txt

Will convert the binary output to a text file (thanks @martineau)

like image 57
PvK Avatar answered Oct 30 '25 23:10

PvK



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!