这些库可帮助您进行 Python 开发:调试器使您可以单步执行代码,分析堆栈框架和设置断点等,并且探查器运行代码并为您提供详细的执行时间细分,从而使您可以识别程序中的瓶颈。审核事件提供了对运行时行为的可见性,否则这些运行时行为将需要侵入式调试或修补。
审核事件表
bdb —调试器框架
faulthandler —转储 Pythontraceback
倾销 traceback
故障处理程序状态
超时后转储回溯
将回溯转储到用户 signal 上
文件 Descriptors 出现问题
Example
pdb — Python 调试器
Debugger Commands
Python Profilers
探查器简介
即时用户手册
配置文件和 cProfile 模块参考
统计课
什么是确定性分析?
Limitations
Calibration
使用自定义计时器
timeit —测量小代码段的执行时间
Basic Examples
Python Interface
Command-Line Interface
Examples
trace —跟踪或跟踪 Python 语句的执行
Command-Line Usage
Main options
Modifiers
Filters
Programmatic Interface
tracemalloc-跟踪内存分配
显示前十名
Compute differences
获取内存块的 traceback
Pretty top
API
Functions
DomainFilter
Filter
Frame
Snapshot
Statistic
StatisticDiff
Trace
Traceback