Skip to content

Commit 9e3a0a4

Browse files
pavelsavaraCopilot
andcommitted
[browser] Remove instrumentation interval suffix support
Require explicit WasmEnvironmentVariable configuration for the EventPipe sampling rate and reject the old WasmPerformanceInstrumentation suffix. Keep Mono browser-profiler interval descriptors unchanged. Co-authored-by: Copilot <[email protected]>
1 parent 31fcef3 commit 9e3a0a4

2 files changed

Lines changed: 12 additions & 28 deletions

File tree

‎src/mono/browser/build/BrowserWasmApp.CoreCLR.targets‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,21 +81,13 @@
8181
<WasmInitialHeapSize Condition="'$(WasmInitialHeapSize)' == ''">$(EmccInitialHeapSize)</WasmInitialHeapSize>
8282
</PropertyGroup>
8383

84-
<!-- Diagnostics: transform Mono-style WasmPerformanceInstrumentation property into CoreCLR env vars.
85-
Input format: "all,interval=0" or "N:Namespace" or "all" (Mono convention)
86-
Output: DOTNET_WasmPerformanceInstrumentation=<MethodSet filter> ('all' mapped to '*')
87-
DOTNET_EventPipeThreadSamplingRate=<ms> (if interval= specified) -->
84+
<!-- Map the Mono-style "all" instrumentation filter to the CoreCLR MethodSet wildcard. -->
8885
<PropertyGroup Condition="'$(EnableDiagnostics)' == 'true' and '$(WasmPerformanceInstrumentation)' != ''">
8986
<_WasmPerfInstFilter>$(WasmPerformanceInstrumentation)</_WasmPerfInstFilter>
90-
<_WasmPerfInstInterval></_WasmPerfInstInterval>
91-
<_WasmPerfInstInterval Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))">$(WasmPerformanceInstrumentation.Substring($([MSBuild]::Add($(WasmPerformanceInstrumentation.IndexOf(',interval=')), 10))))</_WasmPerfInstInterval>
92-
<_WasmPerfInstFilter Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))">$(WasmPerformanceInstrumentation.Substring(0, $(WasmPerformanceInstrumentation.IndexOf(',interval='))))</_WasmPerfInstFilter>
93-
<_WasmPerfInstInterval Condition="'$(_WasmPerfInstInterval)' != '' and $(_WasmPerfInstInterval.Contains(','))">$(_WasmPerfInstInterval.Substring(0, $(_WasmPerfInstInterval.IndexOf(','))))</_WasmPerfInstInterval>
9487
<_WasmPerfInstFilter Condition="'$(_WasmPerfInstFilter)' == 'all'">*</_WasmPerfInstFilter>
9588
</PropertyGroup>
9689
<ItemGroup Condition="'$(EnableDiagnostics)' == 'true' and '$(WasmPerformanceInstrumentation)' != ''">
9790
<WasmEnvironmentVariable Include="DOTNET_WasmPerformanceInstrumentation" Value="$(_WasmPerfInstFilter)" />
98-
<WasmEnvironmentVariable Condition="'$(_WasmPerfInstInterval)' != ''" Include="DOTNET_EventPipeThreadSamplingRate" Value="$(_WasmPerfInstInterval)" />
9991
</ItemGroup>
10092

10193
<!-- Task declarations: Both tasks live in WasmAppBuilder.dll -->

‎src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets‎

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -650,39 +650,31 @@ Copyright (c) .NET Foundation. All rights reserved.
650650
</ItemGroup>
651651
</Target>
652652

653-
<Target Name="_AddWasmDiagnosticPortsEnvironmentVariable" Condition="'$(EnableDiagnostics)' == 'true'">
654-
<PropertyGroup>
655-
<_WasmPerfInstFilter>$(WasmPerformanceInstrumentation)</_WasmPerfInstFilter>
656-
<_WasmPerfInstInterval></_WasmPerfInstInterval>
657-
<_WasmPerfInstDescriptor></_WasmPerfInstDescriptor>
658-
<_WasmPerfInstInterval Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))">$(WasmPerformanceInstrumentation.Substring($([MSBuild]::Add($(WasmPerformanceInstrumentation.IndexOf(',interval=')), 10))))</_WasmPerfInstInterval>
659-
<_WasmPerfInstFilter Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))">$(WasmPerformanceInstrumentation.Substring(0, $(WasmPerformanceInstrumentation.IndexOf(',interval='))))</_WasmPerfInstFilter>
660-
<_WasmPerfInstInterval Condition="'$(_WasmPerfInstInterval)' != '' and $(_WasmPerfInstInterval.Contains(','))">$(_WasmPerfInstInterval.Substring(0, $(_WasmPerfInstInterval.IndexOf(','))))</_WasmPerfInstInterval>
661-
<_WasmPerfInstDescriptor Condition="'$(_WasmPerfInstFilter)' != '' and '$(UseMonoRuntime)' != 'false'">eventpipe,callspec=$(_WasmPerfInstFilter)</_WasmPerfInstDescriptor>
662-
<_WasmPerfInstFilter Condition="'$(_WasmPerfInstFilter)' == 'all' and '$(UseMonoRuntime)' == 'false'">*</_WasmPerfInstFilter>
663-
<_WasmPerfInstDescriptor Condition="'$(_WasmPerfInstFilter)' != '' and '$(UseMonoRuntime)' == 'false'">$(_WasmPerfInstFilter)</_WasmPerfInstDescriptor>
664-
</PropertyGroup>
653+
<Target Name="_ValidateWasmPerformanceInstrumentation" BeforeTargets="PrepareForBuild">
654+
<Error Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))"
655+
Text="The interval option is no longer supported in WasmPerformanceInstrumentation. Set DOTNET_EventPipeThreadSamplingRate using a WasmEnvironmentVariable item instead." />
656+
</Target>
657+
658+
<Target Name="_AddWasmDiagnosticPortsEnvironmentVariable"
659+
Condition="'$(EnableDiagnostics)' == 'true'"
660+
DependsOnTargets="_ValidateWasmPerformanceInstrumentation">
665661
<ItemGroup>
666662
<WasmEnvironmentVariable Include="DOTNET_DiagnosticPorts" Value="$(DiagnosticPorts)" Condition="'$(DiagnosticPorts)' != '' and '$(EnableDiagnostics)' == 'true'"/>
667663
</ItemGroup>
668664
</Target>
669665

670-
<!-- CoreCLR: transform WasmPerformanceInstrumentation into separate env vars for MethodSet filter + interval.
666+
<!-- CoreCLR: transform WasmPerformanceInstrumentation into a MethodSet filter.
671667
Mono handles this in WasmApp.Common.targets with "eventpipe,callspec=" prefix, so skip for Mono.
672668
UseMonoRuntime=false indicates CoreCLR; when true or unset, Mono workload targets handle it. -->
673669
<Target Name="_AddWasmPerformanceInstrumentationEnvironmentVariables"
674-
Condition="'$(UseMonoRuntime)' == 'false' and '$(WasmPerformanceInstrumentation)' != ''">
670+
Condition="'$(UseMonoRuntime)' == 'false' and '$(WasmPerformanceInstrumentation)' != ''"
671+
DependsOnTargets="_ValidateWasmPerformanceInstrumentation">
675672
<PropertyGroup>
676673
<_WasmPerfInstFilter>$(WasmPerformanceInstrumentation)</_WasmPerfInstFilter>
677-
<_WasmPerfInstInterval></_WasmPerfInstInterval>
678-
<_WasmPerfInstInterval Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))">$(WasmPerformanceInstrumentation.Substring($([MSBuild]::Add($(WasmPerformanceInstrumentation.IndexOf(',interval=')), 10))))</_WasmPerfInstInterval>
679-
<_WasmPerfInstFilter Condition="$(WasmPerformanceInstrumentation.Contains(',interval='))">$(WasmPerformanceInstrumentation.Substring(0, $(WasmPerformanceInstrumentation.IndexOf(',interval='))))</_WasmPerfInstFilter>
680-
<_WasmPerfInstInterval Condition="'$(_WasmPerfInstInterval)' != '' and $(_WasmPerfInstInterval.Contains(','))">$(_WasmPerfInstInterval.Substring(0, $(_WasmPerfInstInterval.IndexOf(','))))</_WasmPerfInstInterval>
681674
<_WasmPerfInstFilter Condition="'$(_WasmPerfInstFilter)' == 'all'">*</_WasmPerfInstFilter>
682675
</PropertyGroup>
683676
<ItemGroup>
684677
<WasmEnvironmentVariable Include="DOTNET_WasmPerformanceInstrumentation" Value="$(_WasmPerfInstFilter)" />
685-
<WasmEnvironmentVariable Condition="'$(_WasmPerfInstInterval)' != ''" Include="DOTNET_EventPipeThreadSamplingRate" Value="$(_WasmPerfInstInterval)" />
686678
</ItemGroup>
687679
</Target>
688680

0 commit comments

Comments
 (0)