File tree Expand file tree Collapse file tree
test/test_profiling/test_sampling_profiler Expand file tree Collapse file tree Original file line number Diff line number Diff 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 :
Original file line number Diff line number Diff 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 )])])
You can’t perform that action at this time.
0 commit comments