]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-145458: use `self.skip_idle` consistently in the tachyon profiler (#145459)
authorThomas Kowalski <thom.kowa@gmail.com>
Tue, 31 Mar 2026 08:57:07 +0000 (10:57 +0200)
committerGitHub <noreply@github.com>
Tue, 31 Mar 2026 08:57:07 +0000 (09:57 +0100)
Lib/profiling/sampling/stack_collector.py

index 05ebe4d97647583a66798ee85b4d26449ace3f78..31102d3eb0ffa6de780ee27628149ab1242cb64f 100644 (file)
@@ -19,9 +19,9 @@ class StackTraceCollector(Collector):
         self.sample_interval_usec = sample_interval_usec
         self.skip_idle = skip_idle
 
-    def collect(self, stack_frames, timestamps_us=None, skip_idle=False):
+    def collect(self, stack_frames, timestamps_us=None):
         weight = len(timestamps_us) if timestamps_us else 1
-        for frames, thread_id in self._iter_stacks(stack_frames, skip_idle=skip_idle):
+        for frames, thread_id in self._iter_stacks(stack_frames, skip_idle=self.skip_idle):
             self.process_frames(frames, thread_id, weight=weight)
 
     def process_frames(self, frames, thread_id, weight=1):
@@ -88,7 +88,7 @@ class FlamegraphCollector(StackTraceCollector):
         # Per-thread statistics
         self.per_thread_stats = {}  # {thread_id: {has_gil, on_cpu, gil_requested, unknown, has_exception, total, gc_samples}}
 
-    def collect(self, stack_frames, timestamps_us=None, skip_idle=False):
+    def collect(self, stack_frames, timestamps_us=None):
         """Override to track thread status statistics before processing frames."""
         # Weight is number of timestamps (samples with identical stack)
         weight = len(timestamps_us) if timestamps_us else 1
@@ -123,7 +123,7 @@ class FlamegraphCollector(StackTraceCollector):
                 self.per_thread_stats[thread_id][key] += value * weight
 
         # Call parent collect to process frames
-        super().collect(stack_frames, timestamps_us, skip_idle=skip_idle)
+        super().collect(stack_frames, timestamps_us)
 
     def set_stats(self, sample_interval_usec, duration_sec, sample_rate,
                   error_rate=None, missed_samples=None, mode=None):