Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions Lib/profiling/sampling/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ def _build_linear_stacks(self, leaf_task_ids, task_map, child_to_parent):
# Add all frames from all coroutines in this task
if task_info.coroutine_stack:
for coro_info in task_info.coroutine_stack:
for frame in coro_info.call_stack:
frames.append(frame)
frames.extend(coro_info.call_stack)

# Get pre-computed parent info (no sorting needed!)
parent_info = child_to_parent.get(current_id)
Expand Down
6 changes: 3 additions & 3 deletions Lib/profiling/sampling/sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):
sleep_time = (next_time - current_time) * 0.9
if sleep_time > 0.0001:
time.sleep(sleep_time)
elif next_time < current_time:
else:
try:
with _pause_threads(self.unwinder, self.blocking):
if async_aware == "all":
Expand All @@ -126,7 +126,7 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):
raise e from None

# Track actual sampling intervals for real-time stats
if num_samples > 0:
if self.realtime_stats and num_samples > 0:
actual_interval = current_time - last_sample_time
self.sample_intervals.append(
1.0 / actual_interval
Expand All @@ -146,7 +146,7 @@ def sample(self, collector, duration_sec=None, *, async_aware=False):
num_samples += 1
next_time += sample_interval_sec

running_time_sec = time.perf_counter() - start_time
running_time_sec = current_time - start_time
except KeyboardInterrupt:
interrupted = True
running_time_sec = time.perf_counter() - start_time
Expand Down
Loading