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. 这些库帮助您进行Python开发:调试器使您能够单步执行代码、分析堆栈帧和设置断点等,而分析器运行代码并提供执行时间的详细细分,使您能够识别程序中的瓶颈。Auditing events provide visibility into runtime behaviors that would otherwise require intrusive debugging or patching.审核事件提供了对运行时行为的可见性,否则这些行为将需要侵入式调试或修补。
Audit events table审核事件表bdb
—Debugger framework调试器框架faulthandler
—Dump the Python traceback转储Python回溯pdb
—The Python DebuggerPython调试器The Python ProfilersPython探查器timeit
—Measure execution time of small code snippets测量小代码片段的执行时间trace
—Trace or track Python statement execution跟踪或跟踪Python语句执行tracemalloc
—Trace memory allocations跟踪内存分配