cpython/Lib/profiling/sampling
Pablo Galindo Salgado 78b8bd521f gh-142374: Fix recursive function cumulative over-counting in sampling profiler
The sampling profiler counted every frame occurrence in a stack for
cumulative statistics. For recursive functions appearing N times in a stack,
this meant counting N instead of 1, causing cumul% to exceed 100%. A function
recursing 500 deep in every sample would show 50000% cumulative presence.

The fix tracks seen locations per sample using a reused set, ensuring each
unique (filename, lineno, funcname) is counted once per sample. This matches
the expected semantics: cumul% represents the percentage of samples where a
function appeared on the stack, not the sum of all frame occurrences.
2025-12-07 13:45:27 +00:00
..
_assets gh-71648: Optimize PNG files (GH-138842) 2025-09-12 20:13:05 +00:00
_flamegraph_assets gh-140677 Add heatmap visualization to Tachyon sampling profiler (#140680) 2025-12-02 20:33:40 +00:00
_heatmap_assets gh-140677 Improve heatmap colors (#142241) 2025-12-06 20:27:16 +00:00
_shared_assets GH-142363: Contrast and gradient CSS fixes for Tachyon flamegraph (#142364) 2025-12-06 22:09:10 +00:00
_vendor gh-135953: Add flamegraph reporter to sampling profiler (#138715) 2025-09-09 23:06:45 +01:00
live_collector gh-142374: Fix recursive function cumulative over-counting in sampling profiler 2025-12-07 13:45:27 +00:00
__init__.py gh-140677 Add heatmap visualization to Tachyon sampling profiler (#140680) 2025-12-02 20:33:40 +00:00
__main__.py gh-138122: Refactor the CLI of profiling.sampling into subcommands (#141813) 2025-11-24 11:45:08 +00:00
_css_utils.py gh-140677 Add heatmap visualization to Tachyon sampling profiler (#140680) 2025-12-02 20:33:40 +00:00
_sync_coordinator.py gh-140729: Add __mp_main__ as a duplicate for __main__ for pickle to work (#140735) 2025-11-17 12:43:14 +00:00
cli.py GH-141565: Add async code awareness to Tachyon (#141533) 2025-12-06 19:31:40 +00:00
collector.py GH-141565: Add async code awareness to Tachyon (#141533) 2025-12-06 19:31:40 +00:00
constants.py gh-141645: Add a TUI mode to the new tachyon profiler (#141646) 2025-11-20 18:27:17 +00:00
gecko_collector.py gh-138122: Refactor the CLI of profiling.sampling into subcommands (#141813) 2025-11-24 11:45:08 +00:00
heatmap_collector.py gh-142374: Fix recursive function cumulative over-counting in sampling profiler 2025-12-07 13:45:27 +00:00
pstats_collector.py gh-142374: Fix recursive function cumulative over-counting in sampling profiler 2025-12-07 13:45:27 +00:00
sample.py gh-138122: Implement frame caching in RemoteUnwinder to reduce memory reads (#142137) 2025-12-06 22:37:34 +00:00
stack_collector.py GH-141565: Add async code awareness to Tachyon (#141533) 2025-12-06 19:31:40 +00:00
string_table.py gh-135953: Reduce memory usage of stack collectors (#138875) 2025-09-14 23:47:14 +01:00