Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where to hook in extra data to be visualized by columns #2632

Open
JonECG opened this issue Sep 6, 2024 · 1 comment
Open

Where to hook in extra data to be visualized by columns #2632

JonECG opened this issue Sep 6, 2024 · 1 comment
Labels

Comments

@JonECG
Copy link

JonECG commented Sep 6, 2024

Hey there, I'm looking to add some extra columns for a few of my benchmarks where I have mocked a networking layer. I'd like to track the number of network sends as well as the sizes of the sends, averaged over the number of iterations, similar to other columns.

Searching issues here as well as documentation I started going down two paths:

  1. Custom Column

I quickly found the documentation with the simple TagColumn example. However, it's still not clear how to get any extra information from the run. #180 was the closest I could find here.

I could maybe see this working if there was a way for me to emit extra data as part of the run (maybe in global cleanup) that I would index later at column visualization time. But I wasn't able to find any static accessors to get the current benchmark while inside the Global Setup or Cleanup methods that I could use to key my data

  1. Custom Diagnoser

I don't have much experience with the diagnosers, but looking at the ones provided I was very hopeful that I could look at their implementations to see how to get my data into the mix somehow. I was deeply disappointed to see that all of the diagnosers are basically source-embedded to the benchmark results, with no flexibility to add my own, barring a source edit. It wouldn't be the end of the world to add it locally, but we aren't consuming the package as source, so we'd need to start doing that.

I only recently upgraded to the most recent version, so if there was something that was added recently that resolves this, apologies for my ignorance. Thanks!

@timcassell
Copy link
Collaborator

timcassell commented Sep 10, 2024

You can take a look at DotMemoryDiagnoser to get an idea how to hook up your own custom diagnoser.
https://github.com/dotnet/BenchmarkDotNet/blob/ca5dfdf106affb0922f5b8002a67272a27d3fd03/src/BenchmarkDotNet.Diagnostics.dotMemory/DotMemoryDiagnoser.cs
https://github.com/dotnet/BenchmarkDotNet/blob/ca5dfdf106affb0922f5b8002a67272a27d3fd03/src/BenchmarkDotNet/Diagnosers/SnapshotProfilerBase.cs

There is some chatter in #2628 about improving hook points.

There is also #784 for providing custom column data (not currently supported).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants