BlazorWasmProfiler 0.0.1

dotnet add package BlazorWasmProfiler --version 0.0.1
NuGet\Install-Package BlazorWasmProfiler -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorWasmProfiler" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BlazorWasmProfiler --version 0.0.1
#r "nuget: BlazorWasmProfiler, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BlazorWasmProfiler as a Cake Addin
#addin nuget:?package=BlazorWasmProfiler&version=0.0.1

// Install BlazorWasmProfiler as a Cake Tool
#tool nuget:?package=BlazorWasmProfiler&version=0.0.1

BlazorWasmProfiler

Poor Man's Blazor Wasm Profiler

It uses AspectInjector to time the execution of every method in your Blazor WASM project.

It also measures the render time of every Blazor Component that defines these methods:

    protected override void OnParametersSet()
    // or
    protected override async Task OnParametersSetAsync()

    // and

    protected override void OnAfterRender(bool firstRender)
    // or
    protected override async Task OnAfterRenderAsync(bool firstRender)

How to use:

  1. Include NuGet package from https://www.nuget.org/packages/BlazorWasmProfiler

     <ItemGroup>
         <PackageReference Include="BlazorWasmProfiler" Version="0.0.1.0" />
     </ItemGroup>
    
  2. Add [assembly: BlazorTimer] somewhere in your code.

  3. Access statistics:

     var methodStatistics = BlazorTimerAttribute.GetMethodStatistics();
     var renderStatistics = BlazorTimerAttribute.GetRenderStatistics();
    
  4. (optional) Use MethodCallStatistics and RenderTimeStatistics as components

     <BlazorWasmProfiler.MethodCallStatistics />
     <BlazorWasmProfiler.RenderTimeStatistics />
    
  5. (optional) Change

     <Router AppAssembly="@typeof(App).Assembly">
    

    to

     <Router 
         AppAssembly="@typeof(App).Assembly" 
         AdditionalAssemblies="new[] { typeof(BlazorWasmProfiler.BlazorTimerAttribute).Assembly }">
    

    and use MethodCallStatistics and RenderTimeStatistics as pages

     <a href="MethodCallStatistics">Method Call Statistics</a>
     <a href="RenderTimeStatistics">Render Time Statistics</a>
    

Version history:

  • 0.0.1.0:
    • Excluded the body of OnParametersSet() and OnAfterRender(bool firstRender) from render timing
    • Render timing now works with OnParametersSetAsync() and OnAfterRenderAsync(bool firstRender)
    • Added enum StatisticsOrder to get statistics ordered by any property
  • 0.0.0.1:
    • Initial release

Screenshots:

MethodCallStatistics

RenderTimeStatistics

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1 331 8/2/2023
0.0.0.1 170 7/31/2023