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

這些函式庫幫助你進行 Python 程式開發：除錯器允許你在程式碼中單步
(step) 執行、分析堆疊框 (stack frames) 以及設置中斷點 (breakpoints) 等
，效能分析工具執行程式碼並提供關於執行時間的詳細分析，讓你找到程式中的
瓶頸 (bottlenecks)。事件稽核 (auditing events) 提供執行時期行為的可見
性，否則的話可能需要更侵入性的除錯或修補。

* 稽核事件表

* "bdb" --- 偵錯器框架

* "faulthandler" --- 傾印 Python 回溯

  * Dumping the traceback

  * Dumping the C stack

    * C Stack Compatibility

  * Fault handler state

  * Dumping the tracebacks after a timeout

  * Dumping the traceback on a user signal

  * Issue with file descriptors

  * 範例

* "pdb" --- Python 偵錯器

  * 命令列介面

  * 偵錯器命令

* "profiling" --- Python profilers

  * Introduction to profiling

  * 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" --- Deterministic profiler

      * What is deterministic profiling?

      * Command-line interface

      * Programmatic usage examples

        * Basic profiling

        * Using the "Profile" class

      * Module reference

      * Using a custom timer

      * Limitations

    * "profiling.sampling" --- Statistical profiler

      * 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

      * Command-line interface

        * Global options

        * Dump options

        * Sampling options

        * Mode options

        * Output options

        * pstats display options

        * Run command options

* "pstats" --- Statistics for profilers

  * Reading and displaying profile data

    * Working with statistics

    * Filtering output

    * Analyzing call relationships

    * Combining multiple profiles

  * The "Stats" class

  * Command-line interface

* "timeit" --- 測量小量程式片段的執行時間

  * Basic examples

  * Python interface

  * Command-line interface

  * 範例

* "trace" --- 追蹤或追查 Python 陳述式執行

  * 命令列用法

    * 主要選項

    * 修飾子（Modifier）

    * 篩選子（Filter）

  * 程式介面

* "tracemalloc" --- 追蹤記憶體配置

  * 範例

    * Display the top 10

    * Compute differences

    * Get the traceback of a memory block

    * Pretty top

      * Record the current and peak size of all traced memory blocks

  * API

    * 函式

    * DomainFilter

    * Filter

    * Frame

    * Snapshot

    * Statistic

    * StatisticDiff

    * Trace

    * Traceback
