@@ -28,7 +28,7 @@ The Python standard library provides three different profiling implementations:
2828
2929**Statistical Profiler: **
3030
31- 1. :mod: `profile.sample ` provides statistical profiling of running Python processes
31+ 1. :mod: `!profiling.sampling ` provides statistical profiling of running Python processes
3232   using periodic stack sampling. It can attach to any running Python process without
3333   requiring code modification or restart, making it ideal for production debugging.
3434
@@ -55,26 +55,26 @@ The Python standard library provides three different profiling implementations:
5555
5656**Profiler Comparison: **
5757
58- +-------------------+----------------------+----------------------+----------------------+ 
59- |  Feature           |  Statistical          |  Deterministic        |  Deterministic        | 
60- |                    |  (``profile.sample ``) |  (``cProfile ``)       |  (``profile ``)        | 
61- +===================+======================+======================+======================+ 
62- |  **Target **        |  Running process      |  Code you run         |  Code you run         | 
63- +-------------------+----------------------+----------------------+----------------------+ 
64- |  **Overhead **      |  Virtually none       |  Moderate             |  High                 | 
65- +-------------------+----------------------+----------------------+----------------------+ 
66- |  **Accuracy **      |  Statistical approx.  |  Exact call counts    |  Exact call counts    | 
67- +-------------------+----------------------+----------------------+----------------------+ 
68- |  **Setup **         |  Attach to any PID    |  Instrument code      |  Instrument code      | 
69- +-------------------+----------------------+----------------------+----------------------+ 
70- |  **Use Case **      |  Production debugging |  Development/testing  |  Profiler extension   | 
71- +-------------------+----------------------+----------------------+----------------------+ 
72- |  **Implementation**| C extension           |  C extension          |  Pure Python          | 
73- +-------------------+----------------------+----------------------+----------------------+ 
58+ +-------------------+-------------------------- +----------------------+----------------------+ 
59+ |  Feature           |  Statistical               |  Deterministic        |  Deterministic        | 
60+ |                    |  (``profiling.sampling ``) |  (``cProfile ``)       |  (``profile ``)        | 
61+ +===================+========================== +======================+======================+ 
62+ |  **Target **        |  Running process           |  Code you run         |  Code you run         | 
63+ +-------------------+-------------------------- +----------------------+----------------------+ 
64+ |  **Overhead **      |  Virtually none            |  Moderate             |  High                 | 
65+ +-------------------+-------------------------- +----------------------+----------------------+ 
66+ |  **Accuracy **      |  Statistical approx.       |  Exact call counts    |  Exact call counts    | 
67+ +-------------------+-------------------------- +----------------------+----------------------+ 
68+ |  **Setup **         |  Attach to any PID         |  Instrument code      |  Instrument code      | 
69+ +-------------------+-------------------------- +----------------------+----------------------+ 
70+ |  **Use Case **      |  Production debugging      |  Development/testing  |  Profiler extension   | 
71+ +-------------------+-------------------------- +----------------------+----------------------+ 
72+ |  **Implementation**| C extension                |  C extension          |  Pure Python          | 
73+ +-------------------+-------------------------- +----------------------+----------------------+ 
7474
7575.. note ::
7676
77-    The statistical profiler (:mod: `profile.sample `) is recommended for most production
77+    The statistical profiler (:mod: `!profiling.sampling `) is recommended for most production
7878   use cases due to its extremely low overhead and ability to profile running processes
7979   without modification. It can attach to any Python process and collect performance
8080   data with minimal impact on execution speed, making it ideal for debugging
@@ -138,11 +138,11 @@ on an existing application.
138138
139139To profile an existing running process::
140140
141-    python -m profile.sample  1234 
141+    python -m profiling.sampling  1234 
142142
143143To profile with custom settings::
144144
145-    python -m profile.sample  -i 50 -d 30 1234 
145+    python -m profiling.sampling  -i 50 -d 30 1234 
146146
147147**Deterministic Profiling (Development/Testing): **
148148
@@ -218,34 +218,34 @@ them in various ways.
218218Statistical Profiler Command Line Interface
219219=========================================== 
220220
221- .. program :: profile.sample 
221+ .. program :: profiling.sampling 
222222
223- The :mod: `profile.sample ` module can be invoked as a script to profile running processes::
223+ The :mod: `!profiling.sampling ` module can be invoked as a script to profile running processes::
224224
225-    python -m profile.sample  [options] PID 
225+    python -m profiling.sampling  [options] PID 
226226
227227**Basic Usage Examples: **
228228
229229Profile process 1234 for 10 seconds with default settings::
230230
231-    python -m profile.sample  1234 
231+    python -m profiling.sampling  1234 
232232
233233Profile with custom interval and duration, save to file::
234234
235-    python -m profile.sample  -i 50 -d 30 -o profile.stats 1234 
235+    python -m profiling.sampling  -i 50 -d 30 -o profile.stats 1234 
236236
237237Generate collapsed stacks to use with tools like `flamegraph.pl 
238238<https://github.com/brendangregg/FlameGraph> `_::
239239
240-    python -m profile.sample  --collapsed 1234
240+    python -m profiling.sampling  --collapsed 1234
241241
242242Profile all threads, sort by total time::
243243
244-    python -m profile.sample  -a --sort-tottime 1234 
244+    python -m profiling.sampling  -a --sort-tottime 1234 
245245
246246Profile with real-time sampling statistics::
247247
248-    python -m profile.sample  --realtime-stats 1234 
248+    python -m profiling.sampling  --realtime-stats 1234 
249249
250250**Command Line Options: **
251251
@@ -339,13 +339,13 @@ The statistical profiler produces output similar to deterministic profilers but
339339
340340.. _profile-cli :
341341
342- :mod: `profile.sample ` Module Reference
342+ :mod: `!profiling.sampling ` Module Reference
343343======================================================= 
344344
345- .. module :: profile.sample 
345+ .. module :: profiling.sampling 
346346   :synopsis:  Python statistical profiler.
347347
348- This section documents the programmatic interface for the :mod: `profile.sample ` module.
348+ This section documents the programmatic interface for the :mod: `!profiling.sampling ` module.
349349For command-line usage, see :ref: `sampling-profiler-cli `. For conceptual information
350350about statistical profiling, see :ref: `statistical-profiling `
351351
@@ -373,14 +373,14 @@ about statistical profiling, see :ref:`statistical-profiling`
373373   Examples::
374374
375375       # Basic usage - profile process 1234 for 10 seconds 
376-        import profile.sample  
377-        profile.sample .sample(1234) 
376+        import profiling.sampling  
377+        profiling.sampling .sample(1234) 
378378
379379       # Profile with custom settings 
380-        profile.sample .sample(1234, duration_sec=30, sample_interval_usec=50, all_threads=True) 
380+        profiling.sampling .sample(1234, duration_sec=30, sample_interval_usec=50, all_threads=True) 
381381
382382       # Generate collapsed stack traces for flamegraph.pl 
383-        profile.sample .sample(1234, output_format='collapsed', filename='profile.collapsed') 
383+        profiling.sampling .sample(1234, output_format='collapsed', filename='profile.collapsed') 
384384
385385.. class :: SampleProfiler(pid, sample_interval_usec, all_threads) 
386386
@@ -856,7 +856,7 @@ What Is Deterministic Profiling?
856856call *, *function return *, and *exception * events are monitored, and precise
857857timings are made for the intervals between these events (during which time the
858858user's code is executing).  In contrast, :dfn: `statistical profiling ` (which is
859- provided by the :mod: `profile.sample ` module) periodically samples the effective instruction pointer, and
859+ provided by the :mod: `!profiling.sampling ` module) periodically samples the effective instruction pointer, and
860860deduces where time is being spent.  The latter technique traditionally involves
861861less overhead (as the code does not need to be instrumented), but provides only
862862relative indications of where time is being spent.
0 commit comments