diff options
author | W. Trevor King <wking@drexel.edu> | 2011-05-12 09:40:23 -0400 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2011-05-12 09:40:23 -0400 |
commit | 34ab6bac16d20365d24886fc6b3c3b1b9e23f5ea (patch) | |
tree | 396401073c20eebf65e78a7d38d66775ac4cce98 /doc | |
parent | 4920a709bc172ca65cf0f618226c3c2758697528 (diff) | |
download | bugseverywhere-34ab6bac16d20365d24886fc6b3c3b1b9e23f5ea.tar.gz |
Mention Stats.print_callers() in doc/hacking.txt.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/hacking.txt | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/doc/hacking.txt b/doc/hacking.txt index 54be7bc..4c5a464 100644 --- a/doc/hacking.txt +++ b/doc/hacking.txt @@ -71,10 +71,14 @@ execution + childrens' times):: $ python -m cProfile -o profile be [command] [args] $ python -c "import pstats; p=pstats.Stats('profile'); p.sort_stats('cumulative').print_stats(20)" -It's often useful to toss:: +If you want to find out who's calling your expensive function +(e.g. :func:`libbe.util.subproc.invoke`), try:: + + $ python -c "import pstats; p=pstats.Stats('profile'); p.sort_stats('cumulative').print_callers(20)" + +You can also toss:: import sys, traceback print >> sys.stderr, '-'*60, '\n', '\n'.join(traceback.format_stack()[-10:]) -into expensive functions (e.g. :func:`libbe.util.subproc.invoke`) if -you're not sure why they're being called. +into the function itself for a depth-first caller list. |