Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
after sleeping over: 1-100ms latency here is ok
  • Loading branch information
maurycy committed May 18, 2026
commit 20bc76bdcc6af1476eed2e67d36e864846010d63
12 changes: 2 additions & 10 deletions Lib/profiling/sampling/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,6 @@ def flush_pending():
pending_timestamps = []
collector.collect(prev_stack, timestamps_us=ts)

def wait(timeout):
if not timeout:
return
if control_server is not None:
control_server.poll(timeout=timeout)
return
time.sleep(timeout)

try:
while duration_sec is None or running_time_sec < duration_sec:
current_time = time.perf_counter()
Expand All @@ -158,7 +150,7 @@ def wait(timeout):
if enabled_since is not None:
enabled_time_sec += current_time - enabled_since
enabled_since = None
wait(sample_interval_sec)
time.sleep(sample_interval_sec)
running_time_sec = time.perf_counter() - start_time
continue

Expand All @@ -172,7 +164,7 @@ def wait(timeout):
if next_time > current_time:
sleep_time = (next_time - current_time) * 0.9
if sleep_time > 0.0001:
wait(sleep_time)
time.sleep(sleep_time)
elif next_time < current_time:
try:
stack_frames = self._get_stack_trace(
Expand Down
Loading