python -m cProfile -o profile.out example.py
1. show text
python -c "import pstats; p=pstats.Stats('profile.out'); p.sort_stats('time').print_stats()"
1. or draw a plot
pip install gprof2dot
gprof2dot -f pstats profile.out | dot -Tsvg -o output.svg