Skip to content

Commit 20bc76b

Browse files
committed
after sleeping over: 1-100ms latency here is ok
1 parent 63447d3 commit 20bc76b

1 file changed

Lines changed: 2 additions & 10 deletions

File tree

Lib/profiling/sampling/sample.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,14 +135,6 @@ def flush_pending():
135135
pending_timestamps = []
136136
collector.collect(prev_stack, timestamps_us=ts)
137137

138-
def wait(timeout):
139-
if not timeout:
140-
return
141-
if control_server is not None:
142-
control_server.poll(timeout=timeout)
143-
return
144-
time.sleep(timeout)
145-
146138
try:
147139
while duration_sec is None or running_time_sec < duration_sec:
148140
current_time = time.perf_counter()
@@ -158,7 +150,7 @@ def wait(timeout):
158150
if enabled_since is not None:
159151
enabled_time_sec += current_time - enabled_since
160152
enabled_since = None
161-
wait(sample_interval_sec)
153+
time.sleep(sample_interval_sec)
162154
running_time_sec = time.perf_counter() - start_time
163155
continue
164156

@@ -172,7 +164,7 @@ def wait(timeout):
172164
if next_time > current_time:
173165
sleep_time = (next_time - current_time) * 0.9
174166
if sleep_time > 0.0001:
175-
wait(sleep_time)
167+
time.sleep(sleep_time)
176168
elif next_time < current_time:
177169
try:
178170
stack_frames = self._get_stack_trace(

0 commit comments

Comments
 (0)