tracecalls#
- class tracecalls(trace, exclude=None, regex=False, repeats=False, **kwargs)[source]#
Bases:
prettyobj
Trace all function calls.
Alias to
sys.steprofile()
.- Parameters:
trace (str/list/regex) – the module(s)/file(s) to trace calls from (’’ matches all, but this is inadvisable!)
exclude (str/list/regex) – a list of modules/files to exclude (default ‘<’, which excludes builtins)
regex (bool) – whether to interpret trace and exclude as regexes rather than simple string matching
repeats (bool) – whether to record repeat calls of the same function (default False)
kwargs (dict) – passed to
sys.setprofile
Examples:
import mymodule as mm # In context block with sc.tracecalls('mymodule'): mm.big_operation() # Explicitly tc = sc.tracecalls('*mysubmodule*', exclude='^init*', regex=True, repeats=True) tc.start() mm.big_operation() tc.stop() tc.df.disp()
New in version 3.2.0.Methods