@@ -53,7 +53,7 @@ counts**, not direct measurements. Tachyon counts how many times each function
5353appears in the collected samples, then multiplies by the sampling interval to
5454estimate time.
5555
56- For example, with a 100 microsecond sampling interval over a 10-second profile,
56+ For example, with a 10 kHz sampling rate over a 10-second profile,
5757Tachyon collects approximately 100,000 samples. If a function appears in 5,000
5858samples (5% of total), Tachyon estimates it consumed 5% of the 10-second
5959duration, or about 500 milliseconds. This is a statistical estimate, not a
@@ -142,7 +142,7 @@ Use live mode for real-time monitoring (press ``q`` to quit)::
142142
143143Profile for 60 seconds with a faster sampling rate::
144144
145- python -m profiling.sampling run -d 60 -i 50 script.py
145+ python -m profiling.sampling run -d 60 -r 20khz script.py
146146
147147Generate a line-by-line heatmap::
148148
@@ -241,8 +241,8 @@ is unaware it is being profiled.
241241When profiling production systems, keep these guidelines in mind:
242242
243243Start with shorter durations (10-30 seconds) to get quick results, then extend
244- if you need more statistical accuracy. The default 10-second duration is usually
245- sufficient to identify major hotspots.
244+ if you need more statistical accuracy. By default, profiling runs until the
245+ target process completes, which is usually sufficient to identify major hotspots.
246246
247247If possible, profile during representative load rather than peak traffic.
248248Profiles collected during normal operation are easier to interpret than those
@@ -326,10 +326,10 @@ The default configuration works well for most use cases:
326326
327327 * - Option
328328 - Default
329- * - Default for ``--interval `` / ``-i ``
330- - 100 µs between samples (~10,000 samples/sec)
329+ * - Default for ``--sampling-rate `` / ``-r ``
330+ - 1 kHz
331331 * - Default for ``--duration `` / ``-d ``
332- - 10 seconds
332+ - Run to completion
333333 * - Default for ``--all-threads `` / ``-a ``
334334 - Main thread only
335335 * - Default for ``--native ``
@@ -346,33 +346,31 @@ The default configuration works well for most use cases:
346346 - Disabled (non-blocking sampling)
347347
348348
349- Sampling interval and duration
350- ------------------------------
349+ Sampling rate and duration
350+ --------------------------
351351
352- The two most fundamental parameters are the sampling interval and duration.
352+ The two most fundamental parameters are the sampling rate and duration.
353353Together, these determine how many samples will be collected during a profiling
354354session.
355355
356- The :option: `--interval ` option (:option: `-i `) sets the time between samples in
357- microseconds. The default is 100 microseconds, which produces approximately
358- 10,000 samples per second::
356+ The :option: `--sampling-rate ` option (:option: `-r `) sets how frequently samples
357+ are collected. The default is 1 kHz (10,000 samples per second)::
359358
360- python -m profiling.sampling run -i 50 script.py
359+ python -m profiling.sampling run -r 20khz script.py
361360
362- Lower intervals capture more samples and provide finer-grained data at the
363- cost of slightly higher profiler CPU usage. Higher intervals reduce profiler
361+ Higher rates capture more samples and provide finer-grained data at the
362+ cost of slightly higher profiler CPU usage. Lower rates reduce profiler
364363overhead but may miss short-lived functions. For most applications, the
365- default interval provides a good balance between accuracy and overhead.
364+ default rate provides a good balance between accuracy and overhead.
366365
367- The :option: `--duration ` option (:option: `-d `) sets how long to profile in seconds. The
368- default is 10 seconds ::
366+ The :option: `--duration ` option (:option: `-d `) sets how long to profile in seconds. By
367+ default, profiling continues until the target process exits or is interrupted ::
369368
370369 python -m profiling.sampling run -d 60 script.py
371370
372- Longer durations collect more samples and produce more statistically reliable
373- results, especially for code paths that execute infrequently. When profiling
374- a program that runs for a fixed time, you may want to set the duration to
375- match or exceed the expected runtime.
371+ Specifying a duration is useful when attaching to long-running processes or when
372+ you want to limit profiling to a specific time window. When profiling a script,
373+ the default behavior of running to completion is usually what you want.
376374
377375
378376Thread selection
@@ -573,9 +571,9 @@ appended:
573571- For pstats format (which defaults to stdout), subprocesses produce files like
574572 ``profile_12345.pstats ``
575573
576- The subprocess profilers inherit most sampling options from the parent (interval,
577- duration, thread selection, native frames, GC frames, async-aware mode, and
578- output format). All Python descendant processes are profiled recursively,
574+ The subprocess profilers inherit most sampling options from the parent (sampling
575+ rate, duration, thread selection, native frames, GC frames, async-aware mode,
576+ and output format). All Python descendant processes are profiled recursively,
579577including grandchildren and further descendants.
580578
581579Subprocess detection works by periodically scanning for new descendants of
@@ -1389,13 +1387,13 @@ Global options
13891387Sampling options
13901388----------------
13911389
1392- .. option :: -i < microseconds >, --interval < microseconds >
1390+ .. option :: -r < rate >, --sampling-rate < rate >
13931391
1394- Sampling interval in microseconds . Default: 100 .
1392+ Sampling rate (for example, `` 10000 ``, `` 10khz ``, `` 10k ``) . Default: `` 1khz `` .
13951393
13961394.. option :: -d <seconds >, --duration <seconds >
13971395
1398- Profiling duration in seconds. Default: 10 .
1396+ Profiling duration in seconds. Default: run to completion .
13991397
14001398.. option :: -a , --all-threads
14011399
0 commit comments