From 6e0fcf0e839d60fe39d4b7345166daecacfded75 Mon Sep 17 00:00:00 2001 From: maurycy <5383+maurycy@users.noreply.github.com> Date: Fri, 30 Jan 2026 13:36:47 +0100 Subject: [PATCH] sleep proof of concept --- Lib/profiling/sampling/sample.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/profiling/sampling/sample.py b/Lib/profiling/sampling/sample.py index e73306ebf290e7..bac2e0ece99eca 100644 --- a/Lib/profiling/sampling/sample.py +++ b/Lib/profiling/sampling/sample.py @@ -95,7 +95,11 @@ def sample(self, collector, duration_sec=None, *, async_aware=False): break current_time = time.perf_counter() - if next_time < current_time: + if next_time > current_time: + sleep_time = (next_time - current_time) * 0.9 + if sleep_time > 0.0001: + time.sleep(sleep_time) + elif next_time < current_time: try: with _pause_threads(self.unwinder, self.blocking): if async_aware == "all":