python / python/cpython

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

Offen
#137,022 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

OS-windows performance topic-JIT type-feature
Vorherrschende Sprache
Python
Sterne
77.2k
Forks
35.9k
PR-Merge-Kennzahlen
PR-Kennzahlen ausstehend

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der im Issue verlinkten Dokumentation zu perf maps und jitdump, lies anschließend die Diskussion in #136461 und vergleiche die dort referenzierten Implementierungen von Firefox, Chromium, UnityEtwSymbols und ChakraCore. Als abgeschlossen gilt die Aufgabe, wenn Windows-ETW-Ereignisse Namen und Adressen von JITed-Python-Funktionen offenlegen, sodass samply und Windows Performance Analyzer sie zuordnen können.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
performance
Issue-Typ
Feature
Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.