Debugging and profiling
***********************

这些库可以帮助你进行 Python 开发：调试器使你能够逐步执行代码，分析堆栈
帧并设置断点等等，性能分析器可以运行代码并为你提供执行时间的详细数据，
使你能够找出你的程序中的瓶颈。 审计事件提供运行时行为的可见性，如果没
有此工具则需要进行侵入式调试或修补。

* 审计事件表

* "bdb" --- 调试器框架

* "faulthandler" --- 转储 Python 回溯信息

  * 转储跟踪信息

  * 对 C 栈进行转储

    * C 栈兼容性

  * 故障处理程序的状态

  * 一定时间后转储跟踪数据

  * 转储用户信号的跟踪信息

  * 文件描述符相关话题

  * 示例

* "pdb" --- The Python Debugger

  * 命令行接口

  * 调试器命令

* "profiling" --- Python 性能分析器

  * 性能分析简介

  * Choosing a profiler

    * When to use statistical sampling

    * When to use deterministic tracing

  * Quick start

    * Statistical profiling

    * Deterministic profiling

  * Understanding profile output

  * Legacy compatibility

    * "profiling.tracing" --- 确定型性能分析器

      * What is deterministic profiling?

      * 命令行接口

      * Programmatic usage examples

        * Basic profiling

        * 使用 "Profile" 类

      * 模块参考

      * 使用自定义计时器

      * 局限性

    * "profiling.sampling" --- 统计型性能分析器

      * What is statistical profiling?

        * How time is estimated

        * When to use a different approach

      * Quick examples

      * Commands

        * The "run" command

        * The "attach" command

        * The "dump" command

        * The "replay" command

        * Profiling in production

        * Platform requirements

        * Version compatibility

      * Sampling configuration

        * Sampling rate and duration

        * Thread selection

        * Blocking mode

        * Special frames

        * Opcode-aware profiling

        * Real-time statistics

        * Subprocess profiling

        * Sampling efficiency

      * Profiling modes

        * Wall-clock mode

        * CPU mode

        * Comparing wall-clock and CPU profiles

        * GIL mode

        * Exception mode

      * Output formats

        * pstats format

        * Collapsed stacks format

        * Flame graph format

          * Differential flame graphs

        * Gecko format

        * Heatmap format

        * Binary format

      * Record and replay workflow

      * Live mode

        * Keyboard commands

      * Async-aware profiling

        * Async modes

        * Task markers and stack reconstruction

        * Option restrictions

      * 命令行接口

        * Global options

        * Dump options

        * Sampling options

        * Mode options

        * Output options

        * pstats display options

        * Run command options

* "pstats" --- 性能分析器的统计信息

  * Reading and displaying profile data

    * Working with statistics

    * Filtering output

    * Analyzing call relationships

    * Combining multiple profiles

  * The "Stats" class

  * 命令行接口

* "timeit" --- 测量小代码片段的执行时间

  * Basic examples

  * Python interface

  * 命令行接口

  * 例子

* "trace" --- 跟踪或记录 Python 语句的执行

  * 命令行用法

    * 主要的可选参数

    * 修饰器

    * 过滤器

  * 编程接口

* "tracemalloc" --- 跟踪内存分配

  * 例子

    * 显示前10项

    * 计算差异

    * 获取一个内存块的溯源

    * 美化的 top

      * 记录所有被追踪内存块的当前和峰值大小

  * API

    * 函数

    * 域过滤器

    * 过滤器

    * 帧

    * 快照

    * 统计

    * StatisticDiff

    * 跟踪

    * 回溯
