python / python/cpython

Add ETW instrumentation to allow profilers to map JITed code to function names

Đang mở
#137,022 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

OS-windows performance topic-JIT type-feature
Ngôn ngữ chính
Python
Star
77.2k
Fork
35.9k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Feature or enhancement

Proposal:

For Linux and macOS, currently cpython has perf maps/jitdump support (macOS support is added in #136461)

In here, Jeff mentioned that Windows support is possible through ETW JSCRIPT9::MethodLoad events instead of jitdump: https://github.com/python/cpython/pull/136461#issuecomment-3104217608

This will allow samply and also Windows Performance Analyzer to read and inject these JITed function names.

Firefox and Chrome both emit these events for jitted JS code:
https://bugzilla.mozilla.org/show_bug.cgi?id=1765402
https://bugs.chromium.org/p/v8/issues/detail?id=11043

For more specifically, code for this is here:
https://searchfox.org/mozilla-central/rev/387160feb07b75ae76bfc12df035a10f58d25168/js/src/jit/PerfSpewer.cpp#643
https://chromium.googlesource.com/v8/v8/+/88926769783fecb3bd3b08a7a0cb702b037d9f85/src/diagnostics/system-jit-win.cc

Some more links that were mentioned in other bugs:
https://github.com/Zhentar/UnityEtwSymbols/blob/e3614341a9553b2c916c9ebb12ace4a0eb46291b/etwSymbols.c
https://github.com/chakra-core/ChakraCore/blob/1eae003b7a981b4b691928daef27b5254a49f5eb/lib/Runtime/Language/AsmJsEncoder.cpp#L246

Note: ETW stands for Event Tracing for Windows

cc @pablogsal

Has this already been discussed elsewhere?

No response given

Links to previous discussion of this feature:

#136461.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với tài liệu về perf maps và jitdump được liên kết trong issue, sau đó đọc phần thảo luận trong #136461 và so sánh các triển khai Firefox, Chromium, UnityEtwSymbols và ChakraCore được tham chiếu. Hoàn thành khi các sự kiện ETW của Windows hiển thị tên và địa chỉ của các hàm Python JITed để samply và Windows Performance Analyzer có thể ánh xạ chúng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
performance
Loại issue
Tính năng
Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.