Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-145458: useself.skip_idle#145459

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
KowalskiThomas wants to merge1 commit intopython:main
base:main
Choose a base branch
Loading
fromKowalskiThomas:kowalski/gh-145458-use-self-skip_idle
Draft
Changes fromall 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
8 changes: 4 additions & 4 deletionsLib/profiling/sampling/stack_collector.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -19,9 +19,9 @@ def __init__(self, sample_interval_usec, *, skip_idle=False):
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):
Expand DownExpand Up@@ -88,7 +88,7 @@ def __init__(self, *args, **kwargs):
# 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
Expand DownExpand Up@@ -123,7 +123,7 @@ def collect(self, stack_frames, timestamps_us=None, skip_idle=False):
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):
Expand Down
Loading

[8]ページ先頭

©2009-2026 Movatter.jp