-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[browser] profiler setup and env variables #113339
Conversation
- new WasmEnvironmentVariable item list - new WasmAppBuilder.EnvVariables - fixed enablePerfTracing || enableBrowserProfiler for profiler events - simplified mono profiler setup - split LogProfilerTest and BrowserProfilerTest
Tagging subscribers to 'arch-wasm': @lewing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Overview
This PR enhances the WebAssembly profiler setup and environment variable configuration for .NET by refining profiler initialization, updating test assets, and modifying runtime and build tasks to better support browser and log profilers.
- Introduces a new EnvVariables item in WasmAppBuilder and updates BootJsonData to use a Dictionary for environment variables.
- Splits and renames profiler tests to clearly separate LogProfiler and BrowserProfiler scenarios.
- Adjusts runtime initialization and cwraps configuration to support new profiler setup logic.
Reviewed Changes
File | Description |
---|---|
src/mono/wasm/testassets/WasmBasicTestApp/App/BrowserProfilerTest.cs | Adds a new browser profiler test. |
src/mono/wasm/Wasm.Build.Tests/DiagnosticsTests.cs | Renames and updates tests for log and browser profiler support. |
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js | Updates test case names and profiler configuration strings. |
src/tasks/WasmAppBuilder/WasmAppBuilder.cs | Adds EnvVariables property and integrates it into boot.json generation. |
src/mono/browser/runtime/profiler.ts | Refactors profiler initialization logic for log profiler. |
src/mono/browser/runtime/startup.ts | Updates environment variable and profiler initialization logic. |
src/mono/browser/runtime/cwraps.ts | Adjusts condition for including profiler cwraps based on profiler configuration. |
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs | Changes environmentVariables type from object to Dictionary for clarity. |
src/mono/browser/runtime/es6/dotnet.es6.lib.js | Cleans up profiler and runtime configuration properties. |
src/mono/wasm/testassets/WasmBasicTestApp/App/LogProfilerTest.cs | Renames test class to align with log profiler testing. |
src/mono/browser/runtime/jiterpreter.ts | Updates condition to include browser profiler support in jiterpreter profiling. |
Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/mono/browser/runtime/profiler.ts:46
- Since the assertion guarantees that options.takeHeapshot is defined, the subsequent 'if (options.takeHeapshot)' check and its else branch may be redundant. Consider refactoring this conditional to streamline the logic.
mono_assert(options.takeHeapshot, "Log profiler is not enabled, the takeHeapshot method must be defined in LogProfilerOptions.takeHeapshot");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good to me, nothing strikes me as incorrect, although I don't have a lot of context.
My understanding is that this is enabled through the build, and then flows down to the runtime, with the most relevant change being the ability to add environment variables through the build on demand (which was not possible before).
Am I missing something?
It was/is possible on runtime, there is JS and managed API for it. |
- remove WASM_PERFTRACING from rollup - remove mono_wasm_diagnostic_imports and include it always
DOTNET_DiagnosticPorts
byDiagnosticPorts
MSBuild property, same as other mono platformsWasmEnvironmentVariable
item listWasmAppBuilder.EnvVariables
FeaturePerfTracing
whenWasmPerfTracing
enablePerfTracing
||enableBrowserProfiler
for profiler eventscwraps
LogProfilerTest
andBrowserProfilerTest
Contributes to #76316