Skip to content

Commit 9ce830c

Browse files
committed
Setup and Cleanup are jitted together with benchmark, #736
1 parent 38d0606 commit 9ce830c

File tree

3 files changed

+33
-40
lines changed

3 files changed

+33
-40
lines changed

tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTargetSpecificBenchmarkTest.cs

+20-27
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ namespace BenchmarkDotNet.IntegrationTests
1111
{
1212
public class AllSetupAndCleanupTargetSpecificBenchmarkTest : BenchmarkTestExecutor
1313
{
14-
1514
private const string FirstPrefix = "// ### First Called: ";
1615
private const string FirstGlobalSetupCalled = FirstPrefix + "GlobalSetup";
1716
private const string FirstGlobalCleanupCalled = FirstPrefix + "GlobalCleanup";
@@ -31,51 +30,45 @@ public class AllSetupAndCleanupTargetSpecificBenchmarkTest : BenchmarkTestExecut
3130
private readonly string[] firstExpectedLogLines = {
3231
"// ### First Called: GlobalSetup",
3332

34-
"// ### First Called: IterationSetup (1)", // IterationSetup Jitting
35-
"// ### First Called: IterationCleanup (1)", // IterationCleanup Jitting
36-
37-
"// ### First Called: IterationSetup (2)", // MainWarmup1
33+
"// ### First Called: IterationSetup (1)", // MainWarmup1
3834
"// ### First Called: Benchmark", // MainWarmup1
39-
"// ### First Called: IterationCleanup (2)", // MainWarmup1
40-
"// ### First Called: IterationSetup (3)", // MainWarmup2
35+
"// ### First Called: IterationCleanup (1)", // MainWarmup1
36+
"// ### First Called: IterationSetup (2)", // MainWarmup2
4137
"// ### First Called: Benchmark", // MainWarmup2
42-
"// ### First Called: IterationCleanup (3)", // MainWarmup2
38+
"// ### First Called: IterationCleanup (2)", // MainWarmup2
4339

44-
"// ### First Called: IterationSetup (4)", // MainTarget1
40+
"// ### First Called: IterationSetup (3)", // MainTarget1
4541
"// ### First Called: Benchmark", // MainTarget1
46-
"// ### First Called: IterationCleanup (4)", // MainTarget1
47-
"// ### First Called: IterationSetup (5)", // MainTarget2
42+
"// ### First Called: IterationCleanup (3)", // MainTarget1
43+
"// ### First Called: IterationSetup (4)", // MainTarget2
4844
"// ### First Called: Benchmark", // MainTarget2
49-
"// ### First Called: IterationCleanup (5)", // MainTarget2
50-
"// ### First Called: IterationSetup (6)", // MainTarget3
45+
"// ### First Called: IterationCleanup (4)", // MainTarget2
46+
"// ### First Called: IterationSetup (5)", // MainTarget3
5147
"// ### First Called: Benchmark", // MainTarget3
52-
"// ### First Called: IterationCleanup (6)", // MainTarget3
48+
"// ### First Called: IterationCleanup (5)", // MainTarget3
5349

5450
"// ### First Called: GlobalCleanup"
5551
};
5652

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

60-
"// ### Second Called: IterationSetup (1)", // IterationSetup Jitting
61-
"// ### Second Called: IterationCleanup (1)", // IterationCleanup Jitting
62-
63-
"// ### Second Called: IterationSetup (2)", // MainWarmup1
56+
"// ### Second Called: IterationSetup (1)", // MainWarmup1
6457
"// ### Second Called: Benchmark", // MainWarmup1
65-
"// ### Second Called: IterationCleanup (2)", // MainWarmup1
66-
"// ### Second Called: IterationSetup (3)", // MainWarmup2
58+
"// ### Second Called: IterationCleanup (1)", // MainWarmup1
59+
"// ### Second Called: IterationSetup (2)", // MainWarmup2
6760
"// ### Second Called: Benchmark", // MainWarmup2
68-
"// ### Second Called: IterationCleanup (3)", // MainWarmup2
61+
"// ### Second Called: IterationCleanup (2)", // MainWarmup2
6962

70-
"// ### Second Called: IterationSetup (4)", // MainTarget1
63+
"// ### Second Called: IterationSetup (3)", // MainTarget1
7164
"// ### Second Called: Benchmark", // MainTarget1
72-
"// ### Second Called: IterationCleanup (4)", // MainTarget1
73-
"// ### Second Called: IterationSetup (5)", // MainTarget2
65+
"// ### Second Called: IterationCleanup (3)", // MainTarget1
66+
"// ### Second Called: IterationSetup (4)", // MainTarget2
7467
"// ### Second Called: Benchmark", // MainTarget2
75-
"// ### Second Called: IterationCleanup (5)", // MainTarget2
76-
"// ### Second Called: IterationSetup (6)", // MainTarget3
68+
"// ### Second Called: IterationCleanup (4)", // MainTarget2
69+
"// ### Second Called: IterationSetup (5)", // MainTarget3
7770
"// ### Second Called: Benchmark", // MainTarget3
78-
"// ### Second Called: IterationCleanup (6)", // MainTarget3
71+
"// ### Second Called: IterationCleanup (5)", // MainTarget3
7972

8073
"// ### Second Called: GlobalCleanup"
8174
};

tests/BenchmarkDotNet.IntegrationTests/AllSetupAndCleanupTest.cs

+10-13
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,22 @@ public class AllSetupAndCleanupTest : BenchmarkTestExecutor
2222
private readonly string[] expectedLogLines = {
2323
"// ### Called: GlobalSetup",
2424

25-
"// ### Called: IterationSetup (1)", // IterationSetup Jitting
26-
"// ### Called: IterationCleanup (1)", // IterationCleanup Jitting
27-
28-
"// ### Called: IterationSetup (2)", // MainWarmup1
25+
"// ### Called: IterationSetup (1)", // MainWarmup1
2926
"// ### Called: Benchmark", // MainWarmup1
30-
"// ### Called: IterationCleanup (2)", // MainWarmup1
31-
"// ### Called: IterationSetup (3)", // MainWarmup2
27+
"// ### Called: IterationCleanup (1)", // MainWarmup1
28+
"// ### Called: IterationSetup (2)", // MainWarmup2
3229
"// ### Called: Benchmark", // MainWarmup2
33-
"// ### Called: IterationCleanup (3)", // MainWarmup2
30+
"// ### Called: IterationCleanup (2)", // MainWarmup2
3431

35-
"// ### Called: IterationSetup (4)", // MainTarget1
32+
"// ### Called: IterationSetup (3)", // MainTarget1
3633
"// ### Called: Benchmark", // MainTarget1
37-
"// ### Called: IterationCleanup (4)", // MainTarget1
38-
"// ### Called: IterationSetup (5)", // MainTarget2
34+
"// ### Called: IterationCleanup (3)", // MainTarget1
35+
"// ### Called: IterationSetup (4)", // MainTarget2
3936
"// ### Called: Benchmark", // MainTarget2
40-
"// ### Called: IterationCleanup (5)", // MainTarget2
41-
"// ### Called: IterationSetup (6)", // MainTarget3
37+
"// ### Called: IterationCleanup (4)", // MainTarget2
38+
"// ### Called: IterationSetup (5)", // MainTarget3
4239
"// ### Called: Benchmark", // MainTarget3
43-
"// ### Called: IterationCleanup (6)", // MainTarget3
40+
"// ### Called: IterationCleanup (5)", // MainTarget3
4441

4542
"// ### Called: GlobalCleanup"
4643
};

tests/BenchmarkDotNet.IntegrationTests/CoreRtTests.cs

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ public CoreRtTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
1717
[Fact]
1818
public void CoreRtIsSupported()
1919
{
20+
if (IntPtr.Size == sizeof(int)) // CoreRT does not support 32bit yet
21+
return;
22+
2023
var config = ManualConfig.CreateEmpty()
2124
.With(Job.Dry
2225
.With(Runtime.CoreRT)

0 commit comments

Comments
 (0)