Debugging and Profiling¶
These libraries help you with Python development: the debugger enables you to step through code, analyze stack frames and set breakpoints etc., and the profilers run code and give you a detailed breakdown of execution times, allowing you to identify bottlenecks in your programs. Auditing events provide visibility into runtime behaviors that would otherwise require intrusive debugging or patching.
- Audit events table
bdb— Debugger frameworkBdbQuitBreakpointBdbBdb.canonic()Bdb.reset()Bdb.trace_dispatch()Bdb.dispatch_line()Bdb.dispatch_call()Bdb.dispatch_return()Bdb.dispatch_exception()Bdb.is_skipped_line()Bdb.stop_here()Bdb.break_here()Bdb.break_anywhere()Bdb.user_call()Bdb.user_line()Bdb.user_return()Bdb.user_exception()Bdb.do_clear()Bdb.set_step()Bdb.set_next()Bdb.set_return()Bdb.set_until()Bdb.set_trace()Bdb.set_continue()Bdb.set_quit()Bdb.set_break()Bdb.clear_break()Bdb.clear_bpbynumber()Bdb.clear_all_file_breaks()Bdb.clear_all_breaks()Bdb.get_bpbynumber()Bdb.get_break()Bdb.get_breaks()Bdb.get_file_breaks()Bdb.get_all_breaks()Bdb.get_stack()Bdb.format_stack_entry()Bdb.run()Bdb.runeval()Bdb.runctx()Bdb.runcall()
checkfuncname()effective()set_trace()
faulthandler— Dump the Python tracebackpdb— The Python Debugger- The Python Profilers
timeit— Measure execution time of small code snippetstrace— Trace or track Python statement executiontracemalloc— Trace memory allocations