Skip to content

Commit

Permalink
Setup and Cleanup are jitted together with benchmark, #736
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik committed May 22, 2018
1 parent 38d0606 commit 9ce830c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace BenchmarkDotNet.IntegrationTests
{
public class AllSetupAndCleanupTargetSpecificBenchmarkTest : BenchmarkTestExecutor
{

private const string FirstPrefix = "// ### First Called: ";
private const string FirstGlobalSetupCalled = FirstPrefix + "GlobalSetup";
private const string FirstGlobalCleanupCalled = FirstPrefix + "GlobalCleanup";
Expand All @@ -31,51 +30,45 @@ public class AllSetupAndCleanupTargetSpecificBenchmarkTest : BenchmarkTestExecut
private readonly string[] firstExpectedLogLines = {
"// ### First Called: GlobalSetup",

"// ### First Called: IterationSetup (1)", // IterationSetup Jitting
"// ### First Called: IterationCleanup (1)", // IterationCleanup Jitting

"// ### First Called: IterationSetup (2)", // MainWarmup1
"// ### First Called: IterationSetup (1)", // MainWarmup1
"// ### First Called: Benchmark", // MainWarmup1
"// ### First Called: IterationCleanup (2)", // MainWarmup1
"// ### First Called: IterationSetup (3)", // MainWarmup2
"// ### First Called: IterationCleanup (1)", // MainWarmup1
"// ### First Called: IterationSetup (2)", // MainWarmup2
"// ### First Called: Benchmark", // MainWarmup2
"// ### First Called: IterationCleanup (3)", // MainWarmup2
"// ### First Called: IterationCleanup (2)", // MainWarmup2

"// ### First Called: IterationSetup (4)", // MainTarget1
"// ### First Called: IterationSetup (3)", // MainTarget1
"// ### First Called: Benchmark", // MainTarget1
"// ### First Called: IterationCleanup (4)", // MainTarget1
"// ### First Called: IterationSetup (5)", // MainTarget2
"// ### First Called: IterationCleanup (3)", // MainTarget1
"// ### First Called: IterationSetup (4)", // MainTarget2
"// ### First Called: Benchmark", // MainTarget2
"// ### First Called: IterationCleanup (5)", // MainTarget2
"// ### First Called: IterationSetup (6)", // MainTarget3
"// ### First Called: IterationCleanup (4)", // MainTarget2
"// ### First Called: IterationSetup (5)", // MainTarget3
"// ### First Called: Benchmark", // MainTarget3
"// ### First Called: IterationCleanup (6)", // MainTarget3
"// ### First Called: IterationCleanup (5)", // MainTarget3

"// ### First Called: GlobalCleanup"
};

private readonly string[] secondExpectedLogLines = {
"// ### Second Called: GlobalSetup",

"// ### Second Called: IterationSetup (1)", // IterationSetup Jitting
"// ### Second Called: IterationCleanup (1)", // IterationCleanup Jitting

"// ### Second Called: IterationSetup (2)", // MainWarmup1
"// ### Second Called: IterationSetup (1)", // MainWarmup1
"// ### Second Called: Benchmark", // MainWarmup1
"// ### Second Called: IterationCleanup (2)", // MainWarmup1
"// ### Second Called: IterationSetup (3)", // MainWarmup2
"// ### Second Called: IterationCleanup (1)", // MainWarmup1
"// ### Second Called: IterationSetup (2)", // MainWarmup2
"// ### Second Called: Benchmark", // MainWarmup2
"// ### Second Called: IterationCleanup (3)", // MainWarmup2
"// ### Second Called: IterationCleanup (2)", // MainWarmup2

"// ### Second Called: IterationSetup (4)", // MainTarget1
"// ### Second Called: IterationSetup (3)", // MainTarget1
"// ### Second Called: Benchmark", // MainTarget1
"// ### Second Called: IterationCleanup (4)", // MainTarget1
"// ### Second Called: IterationSetup (5)", // MainTarget2
"// ### Second Called: IterationCleanup (3)", // MainTarget1
"// ### Second Called: IterationSetup (4)", // MainTarget2
"// ### Second Called: Benchmark", // MainTarget2
"// ### Second Called: IterationCleanup (5)", // MainTarget2
"// ### Second Called: IterationSetup (6)", // MainTarget3
"// ### Second Called: IterationCleanup (4)", // MainTarget2
"// ### Second Called: IterationSetup (5)", // MainTarget3
"// ### Second Called: Benchmark", // MainTarget3
"// ### Second Called: IterationCleanup (6)", // MainTarget3
"// ### Second Called: IterationCleanup (5)", // MainTarget3

"// ### Second Called: GlobalCleanup"
};
Expand Down
23 changes: 10 additions & 13 deletions tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,22 @@ public class AllSetupAndCleanupTest : BenchmarkTestExecutor
private readonly string[] expectedLogLines = {
"// ### Called: GlobalSetup",

"// ### Called: IterationSetup (1)", // IterationSetup Jitting
"// ### Called: IterationCleanup (1)", // IterationCleanup Jitting

"// ### Called: IterationSetup (2)", // MainWarmup1
"// ### Called: IterationSetup (1)", // MainWarmup1
"// ### Called: Benchmark", // MainWarmup1
"// ### Called: IterationCleanup (2)", // MainWarmup1
"// ### Called: IterationSetup (3)", // MainWarmup2
"// ### Called: IterationCleanup (1)", // MainWarmup1
"// ### Called: IterationSetup (2)", // MainWarmup2
"// ### Called: Benchmark", // MainWarmup2
"// ### Called: IterationCleanup (3)", // MainWarmup2
"// ### Called: IterationCleanup (2)", // MainWarmup2

"// ### Called: IterationSetup (4)", // MainTarget1
"// ### Called: IterationSetup (3)", // MainTarget1
"// ### Called: Benchmark", // MainTarget1
"// ### Called: IterationCleanup (4)", // MainTarget1
"// ### Called: IterationSetup (5)", // MainTarget2
"// ### Called: IterationCleanup (3)", // MainTarget1
"// ### Called: IterationSetup (4)", // MainTarget2
"// ### Called: Benchmark", // MainTarget2
"// ### Called: IterationCleanup (5)", // MainTarget2
"// ### Called: IterationSetup (6)", // MainTarget3
"// ### Called: IterationCleanup (4)", // MainTarget2
"// ### Called: IterationSetup (5)", // MainTarget3
"// ### Called: Benchmark", // MainTarget3
"// ### Called: IterationCleanup (6)", // MainTarget3
"// ### Called: IterationCleanup (5)", // MainTarget3

"// ### Called: GlobalCleanup"
};
Expand Down
3 changes: 3 additions & 0 deletions tests/BenchmarkDotNet.IntegrationTests/CoreRtTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ public CoreRtTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
[Fact]
public void CoreRtIsSupported()
{
if (IntPtr.Size == sizeof(int)) // CoreRT does not support 32bit yet
return;

var config = ManualConfig.CreateEmpty()
.With(Job.Dry
.With(Runtime.CoreRT)
Expand Down

0 comments on commit 9ce830c

Please sign in to comment.