dotnet / dotnet/BenchmarkDotNet

Custom Diagnoser for average CPU and RAM usage during the test

Open
#1,666 1 comment 5 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
11.5k
Forks
1.1k
Avg merge
6d 11h
Merged PRs (30d)
12

Description

I would like to add columns to the benchmarks for the average CPU and RAM usage during the test ([I'm benchmarking network libraries](https://github.com/JohannesDeml/NetworkBenchmarkDotNet)).
I tried using `AddDiagnoser(new EventPipeProfiler(EventPipeProfile.CpuSampling));`, but due to the sheer number of calls in my benchmark, the resulting file is multiple gigabytes in size and takes a long time to process.

I was thinking about creating a custom diagnoser, that uses [PerformanceCounter](https://stackoverflow.com/questions/278071/how-to-get-the-cpu-usage-in-c) for CPU and RAM and takes samples every X ms and calculates an average at the end. Is this possible by extending the `IDiagnoser` or can I achieve this in any other way?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.