Skip to content

Commit a1ad4cd

Browse files
committed
Tighten comments
1 parent 23f5f75 commit a1ad4cd

2 files changed

Lines changed: 3 additions & 8 deletions

File tree

‎Lib/profiling/sampling/stack_collector.py‎

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ def export(self, filename):
6767
return True
6868

6969

70-
# Extra recursion budget for the recursive flamegraph tree walk during export,
71-
# large enough to cover the unwinder's maximum captured stack depth.
70+
# Bounded by the unwinder's maximum captured stack depth (MAX_FRAMES).
7271
_FLAMEGRAPH_RECURSION_MARGIN = 2000
7372

7473

@@ -168,10 +167,7 @@ def set_replay_stats(self, info):
168167
)
169168

170169
def export(self, filename):
171-
# The flamegraph tree is as deep as the deepest sampled stack and is
172-
# walked recursively here (and by json.dumps), so raise the recursion
173-
# limit while exporting. The remote unwinder caps stack depth at
174-
# MAX_FRAMES, so this margin is bounded.
170+
# export() and json.dumps() recurse to the sampled stack depth.
175171
old_limit = sys.getrecursionlimit()
176172
sys.setrecursionlimit(old_limit + _FLAMEGRAPH_RECURSION_MARGIN)
177173
try:

‎Lib/test/test_profiling/test_sampling_profiler/test_collectors.py‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,7 @@ def test_flamegraph_deep_stack_export(self):
596596
self.addCleanup(close_and_unlink, flamegraph_out)
597597

598598
collector = FlamegraphCollector(1000)
599-
# Deeper than the default recursion limit; the tree walk in export()
600-
# used to blow up here.
599+
# Deeper than the default recursion limit.
601600
frames = [MockFrameInfo("f.py", i + 1, f"f{i}") for i in range(1536)]
602601
collector.collect(
603602
[MockInterpreterInfo(0, [MockThreadInfo(1, frames)])])

0 commit comments

Comments
 (0)