Skip to content

Commit 7d031a1

Browse files
gh-145458: use self.skip_idle
1 parent 72eca2a commit 7d031a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Lib/profiling/sampling/stack_collector.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ def __init__(self, sample_interval_usec, *, skip_idle=False):
1919
self.sample_interval_usec = sample_interval_usec
2020
self.skip_idle = skip_idle
2121

22-
def collect(self, stack_frames, timestamps_us=None, skip_idle=False):
22+
def collect(self, stack_frames, timestamps_us=None):
2323
weight = len(timestamps_us) if timestamps_us else 1
24-
for frames, thread_id in self._iter_stacks(stack_frames, skip_idle=skip_idle):
24+
for frames, thread_id in self._iter_stacks(stack_frames, skip_idle=self.skip_idle):
2525
self.process_frames(frames, thread_id, weight=weight)
2626

2727
def process_frames(self, frames, thread_id, weight=1):
@@ -88,7 +88,7 @@ def __init__(self, *args, **kwargs):
8888
# Per-thread statistics
8989
self.per_thread_stats = {} # {thread_id: {has_gil, on_cpu, gil_requested, unknown, has_exception, total, gc_samples}}
9090

91-
def collect(self, stack_frames, timestamps_us=None, skip_idle=False):
91+
def collect(self, stack_frames, timestamps_us=None):
9292
"""Override to track thread status statistics before processing frames."""
9393
# Weight is number of timestamps (samples with identical stack)
9494
weight = len(timestamps_us) if timestamps_us else 1
@@ -123,7 +123,7 @@ def collect(self, stack_frames, timestamps_us=None, skip_idle=False):
123123
self.per_thread_stats[thread_id][key] += value * weight
124124

125125
# Call parent collect to process frames
126-
super().collect(stack_frames, timestamps_us, skip_idle=skip_idle)
126+
super().collect(stack_frames, timestamps_us)
127127

128128
def set_stats(self, sample_interval_usec, duration_sec, sample_rate,
129129
error_rate=None, missed_samples=None, mode=None):

0 commit comments

Comments
 (0)