dotnet / BenchmarkDotNet

Powerful .NET library for benchmarking
https://benchmarkdotnet.org
MIT License
10.56k stars 969 forks source link

Diagnostic improvements #53

Closed AndreyAkinshin closed 8 years ago

AndreyAkinshin commented 8 years ago

@mattwarren, I want the following list of features:

What do you think?

AndreyAkinshin commented 8 years ago

I have tried to implement tasks 1 and 4. Please, review (https://github.com/PerfDotNet/BenchmarkDotNet/commit/28083486f9423229545969617cab4b05909ba346). Now you can add specific diagnostic with a command like arguments like -d=source,runtime (d means diagnostic, target diagosers will be matched by name).

mattwarren commented 8 years ago

I have tried to implement tasks 1 and 4. Please, review (2808348).

Thanks for doing that, at first glance it looks good, but I'll have a more of a look later on today.

2 - I want a special diagnostic BenchmarkIterationMode for diagnostic. It should be run before the pre-warmup stage.

Just curious, what's the reason for this? Is it so the diagnostic doesn't interfere with calculating the invokeCount

3 - Now I have troubles with diagnostic of x86 benchmark from the x64 host application. Can we fix it?

Yeah that's a problem with the CLRMD library, it doesn't want to analyse a 32-bit process from a 64-bit host app. I'll take a look, I think I can fix it by having a small shim 32-bit process that can then launch the 32-bit benchmark.

AndreyAkinshin commented 8 years ago

Thanks for doing that, at first glance it looks good, but I'll have a more of a look later on today.

Ok. I just implemented basic concepts. Please, refactor the diagnostic classes at its discretion.

Just curious, what's the reason for this?

Theoretically, it can affects the warmup process. We should try to avoid any additional logic between our runs. So, I suggest to create a special stage: diagnostic. We can run it directly without hacks like if (line.StartWith("// Warmup") .... The source code will be more clear.

I'll take a look, I think I can fix it by having a small shim 32-bit process that can then launch the 32-bit benchmark

Sounds cool.

mattwarren commented 8 years ago

Theoretically, it can affects the warmup process. We should try to avoid any additional logic between our runs. So, I suggest to create a special stage: diagnostic.

This is fine, I'll can add an extra step and only run it if we need diagnostics, i.e. BenchmarkState.Instance.IterationMode = BenchmarkIterationMode.Diagnostics;

We can run it directly without hacks like if (line.StartWith("// Warmup") .... The source code will be more clear.

I had a look at this, the main problem is that we are in different processes. The diagnostics are run from the main process, where as BenchmarkIterationMode is set in the process we spawn. So the only real way they have to communicate between the 2 is by looking at the console output, or am I missing something?

mattwarren commented 8 years ago

Now being tracked via #160, so closing this old issue