Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jinjinov/blazorwasmprofiler

Poor Man's Blazor Wasm Profiler
https://github.com/jinjinov/blazorwasmprofiler

blazor blazor-client blazor-wasm blazor-webassembly profiler profiling wasm webassembly

Last synced: 3 months ago
JSON representation

Poor Man's Blazor Wasm Profiler

Awesome Lists containing this project

README

        

# 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



2. Add the attribute somewhere in your code

[assembly: BlazorTimer]

[assembly: MethodTimer]
[assembly: RenderTimer]

3. Access statistics

var methodStatistics = BlazorTimerAttribute.GetMethodStatistics();
var renderStatistics = BlazorTimerAttribute.GetRenderStatistics();

var methodStatistics = ExecutionStatistics.GetMethodStatistics();
var renderStatistics = ExecutionStatistics.GetRenderStatistics();

4. (optional) Use `MethodCallStatistics` and `RenderTimeStatistics` as components


5. (optional) Change

to

and use `MethodCallStatistics` and `RenderTimeStatistics` as pages

Method Call Statistics
Render Time Statistics

## 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](https://raw.githubusercontent.com/Jinjinov/BlazorWasmProfiler/main/MethodCallStatistics.png)

![RenderTimeStatistics](https://raw.githubusercontent.com/Jinjinov/BlazorWasmProfiler/main/RenderTimeStatistics.png)