In this post I am going to continue my servies on BenchMarkDotNet and I will explain what the various parameters do that are present in the simplejob attribute.
Now I say all....... the documentation is not great so I will explain what 3 out of the 4 do :)
So If you remember in my previous post I had a MyFirstBenchmark class which contained the details about the benchmark test that I wanted to run. In this class there is an attribute called SimpleJob and this attribute contains a few parameters that can be configured when you run a test. By default BenchMarkDotNet will choose the number of iterations that will return the best precision. However, using the simplejob attribute allows you to quickly get a set of statistics.
Below is how my test was setup:
Now as you can see I had the following parameters in the SimpleJob attribute:
launchCount - This parameter allows you to define how many times the benchmarking test is run
warmupCount - This parameter allows you to define the number of warmup iterations that are performed before the actual test is run
invocationCount - This parameter is the number of times that the test will be run per launch count. So in my screenshot above notepad will be opened 5 times for each launch count
So for example if my launchCount was 5 and my invocation count was set to 5 then notepad would be opened a total of 25 times.
Below are some examples of the output with different parameters set:
Example 1 launchCount = 1 warmupCount = 1 targetCount = 1 invocationCount = 1
Example 2
launchCount = 1 warmupCount = 2 targetCount = 1 invocationCount = 1
The only difference between this and example one is that you can see an extra WorkloadWarmup line on the test.
Example 3
launchCount = 2 warmupCount = 2 targetCount = 1 invocationCount = 2
In this example you will see there is 2 sets of tests (launchcount=2) and the start of each test is show by the //Launch: x/x line.
I hope you found this useful and in my next blog post I will show how this package can be integrated into Specflow.
If you feel the need to comment then please feel free....