trace
¶
program/module to trace Python program or function execution
- Sample use, command line:
- trace.py -c -f counts –ignore-dir ‘$prefix’ spam.py eggs trace.py -t –ignore-dir ‘$prefix’ spam.py eggs trace.py –trackcalls spam.py eggs
- Sample use, programmatically
import sys
# create a Trace object, telling it what to ignore, and whether to # do tracing or line-counting or both. tracer = trace.Trace(ignoredirs=[sys.prefix, sys.exec_prefix,], trace=0,
count=1)# run the new command using the given tracer tracer.run(‘main()’) # make a report, placing output in /tmp r = tracer.results() r.write_results(show_missing=True, coverdir=”/tmp”)
Functions¶
find_executable_linenos (filename) |
Return dict where keys are line numbers in the line number table. |
find_lines (code, strs) |
Return lineno dict for all code objects reachable from code. |
find_lines_from_code (code, strs) |
Return dict where keys are lines in the line number table. |
find_strings (filename) |
Return a dict of possible docstring positions. |
fullmodname (path) |
Return a plausible module name for the path. |
main ([argv]) |
|
modname (path) |
Return a plausible module name for the patch. |
usage (outfile) |
Classes¶
CoverageResults ([counts, calledfuncs, ...]) |
|
Ignore ([modules, dirs]) |
|
Trace ([count, trace, countfuncs, ...]) |