MCPcopy Index your code
hub / github.com/python/cpython / replay_samples

Method replay_samples

Lib/profiling/sampling/binary_reader.py:57–73  ·  view source on GitHub ↗

Replay samples from binary file through a collector. This allows converting binary profiling data to other formats (e.g., flamegraph, pstats) by replaying through the appropriate collector. Args: collector: A Collector instance with a collect() method

(self, collector, progress_callback=None)

Source from the content-addressed store, hash-verified

55 return self._reader.get_info()
56
57 def replay_samples(self, collector, progress_callback=None):
58 """Replay samples from binary file through a collector.
59
60 This allows converting binary profiling data to other formats
61 (e.g., flamegraph, pstats) by replaying through the appropriate
62 collector.
63
64 Args:
65 collector: A Collector instance with a collect() method
66 progress_callback: Optional callable(current, total) for progress
67
68 Returns:
69 int: Number of samples replayed
70 """
71 if self._reader is None:
72 raise RuntimeError("Reader not open. Use as context manager.")
73 return self._reader.replay(collector, progress_callback)
74
75 @property
76 def sample_count(self):

Calls

no outgoing calls