Skip to content

[browser][coreCLR] R2R: Dedicated JS trigger to capture and download the PGO trace #130518

Description

@pavelsavara

Dedicated JS trigger to capture and download the PGO trace

Part of #130524.

Status: draft / issue candidate · Area: CoreCLR-on-WASM, diagnostics/EventPipe, developer UX · Related: #130517 (interp instrumentation), #130521 (PGO feature on WASM)

Goal

A small, developer-invokable JavaScript function — callable from the browser dev-tools console — that captures the in-progress profile as an EventPipe trace and downloads it as a file, mirroring the existing EventPipe developer experience. This lets a profile be collected from a real browser run and converted offline into the precompiler's input.

Why

The interpreter populates the shared profile data (#130517), and the existing EventPipe event can carry it out, but browser emission is otherwise tied to process shutdown. A developer needs an explicit, in-session way to flush and download the trace without exiting the app. A trivial JS trigger plus a file download is far simpler than standing up a diagnostics server or network transport — the same rationale as the existing EventPipe developer flow.

Direction

  • Expose a JS-facing function that starts/stops or flushes the relevant EventPipe session and forces the profile rundown, so the data is emitted mid-session rather than only at shutdown.
  • Deliver the trace as a browser download — no server side.
  • Feed the existing offline conversion. The downloaded trace flows into the already-existing conversion to the precompiler's profile input; no new trace format or tool.
  • Developer/opt-in only. Not part of the default app.

Scope

In: the JS-facing trigger; forcing/flushing the profile emission in-session; downloading the trace file.

Out: the interpreter instrumentation (#130517) and PGO feature enablement (#130521); the offline trace-to-profile conversion (existing tooling); any customer-facing productization.

Success criteria

  • From a running browser app, a developer calls the function and receives a trace file that converts into a usable precompiler profile for that run.

Open questions

  • How to force the profile rundown/flush without a process exit (in-session stop semantics).
  • Which EventPipe configuration/providers to enable for the capture.
  • Capture cost and download mechanics for larger traces in the browser.

Note

This issue was drafted with GitHub Copilot assistance.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions