Skip to content

[browser] add unit test for event pipe profiler #115930

Closed
@pavelsavara

Description

@pavelsavara

Test that .nettrace file produced by event pipe diagnostics and contains expected data

  • in folder src\mono\wasm\Wasm.Build.Tests\ add new test class
  • it should be based on template/asset in src\mono\wasm\testassets\BlazorBasicTestApp\
  • the new test should build the project with <WasmPerfInstrumentation>all,interval=0</WasmPerfInstrumentation> and <WasmPerfTracing>true</WasmPerfTracing> msbuild properties
  • after app start, the test should navigate the browser to Counter page. There is existing CheckCounter and _executeAfterLoaded in the base class that can be used as inspiration.
  • we should execute globalThis.getDotnetRuntime(0).collectCpuSamples({durationSeconds: 5}) and capture the promise
  • then the test should click "Click me" button few times
  • then way for the promise with the trace to resolve
  • use fetch with POST to upload the trace bytes into the server

We also need to change the server to store the trace on disk, where we will read it via Microsoft.Diagnostics.Tracing.TraceEvent nuget package.
There is EventPipeEventSource in that package.
There is relatedt documentation at https://github.com/microsoft/perfview/blob/main/documentation/TraceEvent/TraceEventLibrary.md

Once we open the trace, we should validate that the trace contains events with stack frame for IncrementCount method of the counter page.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions