Add ETW instrumentation to allow profilers to map JITed code to function names
还没有人认领这个 Issue。
- 主要语言
- Python
- 星标
- 77.2k
- 派生
- 36k
- PR 合并指标
- PR 指标待抓取
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
先阅读 issue 中链接的 perf maps 和 jitdump 文档,然后阅读 #136461 中的讨论,并比较其中引用的 Firefox、Chromium、UnityEtwSymbols 和 ChakraCore 实现。当 Windows ETW 事件公开 JITed Python 函数的名称和地址,使 samply 和 Windows Performance Analyzer 能够进行映射时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- performance
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100