Skip to content

Commit 91f604a

Browse files
Merge pull request #243 from petabridge/dev
NBench v.1.2.0
2 parents f0b3f8c + b94c036 commit 91f604a

37 files changed

+1337
-447
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright {yyyy} {name of copyright owner}
189+
Copyright 2015-2018 Petabridge, LLC
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

NBench.sln

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NBench.Tests.Reporting", "t
4444
EndProject
4545
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NBench.TestAssembly", "tests\NBench.TestAssembly\NBench.TestAssembly.csproj", "{D2F62C2C-4D06-4106-BEFF-9038D27F6B06}"
4646
EndProject
47+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NBench.Execution", "src\NBench.Execution\NBench.Execution.csproj", "{746EA7F1-AF54-4643-8DE5-4D423EAC4685}"
48+
EndProject
49+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NBench.Execution.Tests", "tests\NBench.Execution.Tests\NBench.Execution.Tests.csproj", "{40A81803-EC51-4D15-A899-FC11C3BAAB88}"
50+
EndProject
4751
Global
4852
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4953
Debug|Any CPU = Debug|Any CPU
@@ -210,6 +214,30 @@ Global
210214
{D2F62C2C-4D06-4106-BEFF-9038D27F6B06}.Release|x64.Build.0 = Release|Any CPU
211215
{D2F62C2C-4D06-4106-BEFF-9038D27F6B06}.Release|x86.ActiveCfg = Release|Any CPU
212216
{D2F62C2C-4D06-4106-BEFF-9038D27F6B06}.Release|x86.Build.0 = Release|Any CPU
217+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
218+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Debug|Any CPU.Build.0 = Debug|Any CPU
219+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Debug|x64.ActiveCfg = Debug|Any CPU
220+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Debug|x64.Build.0 = Debug|Any CPU
221+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Debug|x86.ActiveCfg = Debug|Any CPU
222+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Debug|x86.Build.0 = Debug|Any CPU
223+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Release|Any CPU.ActiveCfg = Release|Any CPU
224+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Release|Any CPU.Build.0 = Release|Any CPU
225+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Release|x64.ActiveCfg = Release|Any CPU
226+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Release|x64.Build.0 = Release|Any CPU
227+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Release|x86.ActiveCfg = Release|Any CPU
228+
{746EA7F1-AF54-4643-8DE5-4D423EAC4685}.Release|x86.Build.0 = Release|Any CPU
229+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
230+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Debug|Any CPU.Build.0 = Debug|Any CPU
231+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Debug|x64.ActiveCfg = Debug|Any CPU
232+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Debug|x64.Build.0 = Debug|Any CPU
233+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Debug|x86.ActiveCfg = Debug|Any CPU
234+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Debug|x86.Build.0 = Debug|Any CPU
235+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Release|Any CPU.ActiveCfg = Release|Any CPU
236+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Release|Any CPU.Build.0 = Release|Any CPU
237+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Release|x64.ActiveCfg = Release|Any CPU
238+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Release|x64.Build.0 = Release|Any CPU
239+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Release|x86.ActiveCfg = Release|Any CPU
240+
{40A81803-EC51-4D15-A899-FC11C3BAAB88}.Release|x86.Build.0 = Release|Any CPU
213241
EndGlobalSection
214242
GlobalSection(SolutionProperties) = preSolution
215243
HideSolutionNode = FALSE
@@ -225,6 +253,7 @@ Global
225253
{C526F6D9-B1A5-486F-8CC1-43104CBDD38D} = {1F1914B9-8F67-4B51-9738-CDE5AFB2F8DE}
226254
{B488C0E4-BCEA-47DB-AFB4-564484CF7F8D} = {1F1914B9-8F67-4B51-9738-CDE5AFB2F8DE}
227255
{D2F62C2C-4D06-4106-BEFF-9038D27F6B06} = {1F1914B9-8F67-4B51-9738-CDE5AFB2F8DE}
256+
{40A81803-EC51-4D15-A899-FC11C3BAAB88} = {1F1914B9-8F67-4B51-9738-CDE5AFB2F8DE}
228257
EndGlobalSection
229258
GlobalSection(ExtensibilityGlobals) = postSolution
230259
SolutionGuid = {16E8E98A-E07F-4357-9283-CC588D2D5D0F}

README.md

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,29 @@ public class CounterPerfSpecs
5353

5454
After defining some NBench `PerfBenchmark` methods and declaring some measurements, you can run your benchmark by downloading the `NBench.Runner.exe` via NuGet.
5555

56-
### .NET 4.5.2 Runner
56+
### Running NBench Tests with `dotnet nbench`
57+
The easiest way to run NBench in any runtime, .NET Core or .NET Framework is to install the `dotnet-nbench` NuGet package and add it as a `DotNetCliToolReference` to your NBench test projects.
58+
59+
```
60+
<PackageReference Include="NBench" Version="1.2" />
61+
<DotNetCliToolReference Include="dotnet-nbench" Version="1.2" />
62+
```
63+
64+
This will allow you to run NBench specifications for all frameworks your test projects target, including multi-targeted projects, by simply running the following command in the working directory of your test project:
65+
66+
67+
dotnet nbench [--output {dir-path}] [--configuration {file-path}] [--include MyTest*.Perf*,Other*Spec] [--exclude *Long*] [--concurrent {true|false}] [--trace {true|false}] [--teamcity] [--diagnostic]
68+
69+
70+
71+
This will build and compile your project, as well as run the appropriate `NBench.Runner` executable to run your tests and produce an output report.
72+
73+
> N.B. If you don't specify an `--output` setting while running in this mode, `dotnet-nbench` will automatically record all output to the `[currentDir]/PerfResults/[framework]`.
74+
75+
### Stand-alone Runner
76+
Below are the instructions for the standalone `NBench.Runner` package, which is substantially more manual than the `dotnet nbench` runner described above.
77+
78+
#### .NET 4.5.2 Runner
5779

5880
The NBench Runner NuGet package now contains executables that support .NET 4.5.2, .NET Core 1.1/win7-x64, and .NET Core 1.1/debian8-x64 benchmark assembly targets. Before v1.0.3, you would expect the NBench.Runner NuGet package to contain a single executable that works with .NET 4.5.2:
5981

@@ -69,11 +91,15 @@ With the additional .NET Core executables, you will now get two additional subfo
6991
lib/
7092
net452/
7193
NBench.Runner.exe
72-
netcoreapp1.1/
94+
netcoreapp1.0/
7395
win7-x64/
74-
NBench.Runner.exe
75-
debian8-x64/
76-
NBench.Runner
96+
NBench.Runner.dll
97+
netcoreapp2.0/
98+
win7-x64/
99+
NBench.Runner.dll
100+
netcoreapp2.1/
101+
win7-x64/
102+
NBench.Runner.dll
77103
```
78104

79105
You may choose the appropriate executable for your benchmark assembly/architecture combination
@@ -87,52 +113,48 @@ PS> <--packageLocation-->\NBench.Runner\lib\net452\NBench.Runner.exe <--benchmar
87113

88114
And this command will run your `PerfBenchmark` and write output [that looks like this](https://gist.github.com/Aaronontheweb/8e0bfa2cccc63f5bd8bf) to a markdown file in the `output-directory`.
89115

90-
### .NET Core Runner
116+
#### .NET Core Runner
91117

92118
If you have compiled a benchmark assembly that targets .NET Core 1.1, you may use the appropriate executable from the lib/netcoreap1.1 folder of the downloaded NBench.Runner NuGet package;
93119

94-
On 64-bit Windows:
95-
96120
```
97121
PS> Install-Package NBench.Runner
98-
PS> <--packageLocation-->\NBench.Runner\lib\netcoreapp1.1\win7-x64\NBench.Runner.exe <--benchmarkProjectLocation-->\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf"
122+
PS> <--packageLocation-->\NBench.Runner\lib\netcoreapp1.0\win7-x64\NBench.Runner.exe <--benchmarkProjectLocation-->\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf"
99123
```
100124

101-
On 64-bit Debian 8:
102-
103-
```
104-
PS> Install-Package NBench.Runner
105-
PS> <--packageLocation-->\NBench.Runner\lib\netcoreapp1.1\debian8-x64\NBench.Runner.exe <--benchmarkProjectLocation-->\bin\Debug\netcoreapp1.1\MyPerfTests.dll output-directory="C:\Perf"
106-
```
125+
**It's probably easier to just use `dotnet-nbench`**.
107126

108127
## Command Line Parameters
109-
```
110-
NBench.Runner.exe [assembly names] [output-directory={dir-path}] [configuration={file-path}] [include=MyTest*.Perf*,Other*Spec] [exclude=*Long*] [concurrent={true|false}]
111-
```
128+
129+
130+
NBench.Runner.exe [assembly names] [--output {dir-path}] [--configuration {file-path}] [--include MyTest*.Perf*,Other*Spec] [--exclude *Long*] [--concurrent {true|false}] [--trace {true|false}] [--teamcity] [--diagnostic]
131+
112132

113133
* **assembly names** - list of assemblies to load and test. Space delimited. Requires `.dll` or `.exe` at the end of each assembly name
114-
* **output-directory=path** - folder where a Markdown report will be exported. Report will [look like this](https://gist.github.com/Aaronontheweb/8e0bfa2cccc63f5bd8bf)
115-
* **configuration=path** - folder with a config file to be used when loading the `assembly names`
116-
* **include=name test pattern** - a "`,`"(comma) separted list of wildcard pattern to be mached and included in the tests. Default value is `*` (all)
134+
* **--output-directory path** - folder where a Markdown report will be exported. Report will [look like this](https://gist.github.com/Aaronontheweb/8e0bfa2cccc63f5bd8bf)
135+
* **--configuration path** - folder with a config file to be used when loading the `assembly names`
136+
* **--include name test pattern** - a "`,`"(comma) separted list of wildcard pattern to be mached and included in the tests. Default value is `*` (all)
117137
The test is executed on the complete name of the benchmark `Namespace.Class+MethodName`
118-
* **exclude=name test pattern** - a "`,`"(comma) separted list of wildcard pattern to be mached and excluded in the tests. Default value is `` (none)
138+
* **--exclude name test pattern** - a "`,`"(comma) separted list of wildcard pattern to be mached and excluded in the tests. Default value is `` (none)
119139
The test is executed on the complete name of the benchmark `Namespace.Class+MethodName`
120-
* **concurrent=true|false** - disables thread priority and processor affinity operations for all benchmarks. Used only when running multi-threaded benchmarks. Set to `false` (single-threaded) by default.
121-
* **tracing=true|false** - turns on trace capture inside the NBench runner and will save any captured messages to all available output targets, including Markdown reports. Set to `false` by default.
140+
* **-- concurrent true|false** - disables thread priority and processor affinity operations for all benchmarks. Used only when running multi-threaded benchmarks. Set to `false` (single-threaded) by default.
141+
* **--trace true|false** - turns on trace capture inside the NBench runner and will save any captured messages to all available output targets, including Markdown reports. Set to `false` by default.
142+
* **--diagnostic** - turns on diagnostic logging inside the `NBench.Runner` and `dotnet-nbench` executables.
143+
* **--teamcity** - turns on TeamCity message formatting.
122144

123145
Supported wildcard patterns are `*` any string and `?` any char. In order to include a class with all its tests in the benchmark
124146
you need to specify a pattern finishing in `*`. E.g. `include=*.MyBenchmarkClass.*`.
125147

126148
Example patterns:
127149

128150
```
129-
include="*MyBenchmarkClass*" (include all benchmarks in MyBenchmarkClass)
130-
include="*MyBenchmarkClass+MyBenchmark" (include MyBenchmark in MyBenchmarkClass)
131-
include="*MyBenchmarkClass*,*MyOtherBenchmarkClass*" (include all benchmarks in MyBenchmarkClass and MyOtherBenchmarkClass)
151+
--include "*MyBenchmarkClass*" (include all benchmarks in MyBenchmarkClass)
152+
--include "*MyBenchmarkClass+MyBenchmark" (include MyBenchmark in MyBenchmarkClass)
153+
--include "*MyBenchmarkClass*,*MyOtherBenchmarkClass*" (include all benchmarks in MyBenchmarkClass and MyOtherBenchmarkClass)
132154
133-
exclude=*"MyBenchmarkClass* "(exclude all benchmarks in MyBenchmarkClass)
134-
exclude="*MyBenchmarkClass+MyBenchmark" (exclude MyBenchmark in MyBenchmarkClass)
135-
exclude="*MyBenchmarkClass*,*MyOtherBenchmarkClass*" (exclude all benchmarks in MyBenchmarkClass and MyOtherBenchmarkClass)
155+
--exclude "*MyBenchmarkClass* "(exclude all benchmarks in MyBenchmarkClass)
156+
--exclude "*MyBenchmarkClass+MyBenchmark" (exclude MyBenchmark in MyBenchmarkClass)
157+
--exclude "*MyBenchmarkClass*,*MyOtherBenchmarkClass*" (exclude all benchmarks in MyBenchmarkClass and MyOtherBenchmarkClass)
136158
```
137159

138160
## API

RELEASE_NOTES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
#### v1.2.0 July 10 2018
2+
Introduces the `dotnet-nbench` package, which allows all NBench packages to be executed via the `dotnet` CLI regardless of how many frameworks are targeted by a particular project.
3+
4+
You can read more about the details of how the `dotnet-nbench` package works here: https://github.com/Petabridge/NBench/blob/master/README.md#running-nbench-tests-with-dotnet-nbench
5+
6+
**Support for .NET Core 2.0 and 2.1**
7+
All NBench runners now ship with native support for .NET Core 2.0 and .NET Core 2.1.
8+
19
#### v1.1.0 July 1 2018
210
Fixes several major issues with the `NBench.Runner` executable and being able to support .NET Core dependencies. This is the first set of fixes in a series of ongoing changes designed to help make NBench more user-friendly, extensible, and capable of all manner of interesting performance-related tasks.
311

0 commit comments

Comments
 (0)