Project:Portage/Profiling

Collecting profiles
You can run

python -m cpython -o /usr/bin/emerge

To collect a pstats profile in "outfile."

Examining profiles
Assuming you collected a profile above in 'outfile' you can examine it.

python3 import pstats p = pstats.Stats('outfile') p.print_stats

Check out the https://docs.python.org/3/library/profile.html for more details.