Skip to content

Commit 990d03d

Browse files
committed
Discontinue using the BenchMarkDotNet dotnet tool
Resolves #91
1 parent 8cb4475 commit 990d03d

3 files changed

Lines changed: 30 additions & 33 deletions

File tree

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
using BenchmarkDotNet.Configs;
12
using BenchmarkDotNet.Running;
23

3-
namespace HttpMultipartParse.Benchmark
4+
namespace HttpMultipartParser.Benchmark
45
{
56
class Program
67
{
7-
static void Main()
8+
static void Main(string[] args)
89
{
9-
BenchmarkRunner.Run(typeof(Program).Assembly);
10+
IConfig config = null;
1011

11-
// To debug:
12-
// BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new DebugInProcessConfig());
12+
// To debug
13+
// config = new DebugInProcessConfig();
14+
15+
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
1316
}
1417
}
1518
}

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ init:
44

55
# Build script
66
build_script:
7-
- ps: .\build.ps1 -bootstrap
87
- ps: .\build.ps1 -Target AppVeyor
98

109
# Tests

build.cake

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
1-
// Install modules
2-
#module nuget:?package=Cake.DotNetTool.Module&version=0.4.0
3-
4-
// Install .NET tools
5-
#tool dotnet:?package=BenchmarkDotNet.Tool&version=0.12.0
6-
71
// Install tools.
82
#tool nuget:?package=GitVersion.CommandLine&version=5.5.1
93
#tool nuget:?package=GitReleaseManager&version=0.11.0
@@ -346,7 +340,7 @@ Task("Create-Release-Notes")
346340
{
347341
if(string.IsNullOrEmpty(gitHubUserName)) throw new InvalidOperationException("Could not resolve GitHub user name.");
348342
if(string.IsNullOrEmpty(gitHubPassword)) throw new InvalidOperationException("Could not resolve GitHub password.");
349-
343+
350344
GitReleaseManagerCreate(gitHubUserName, gitHubPassword, gitHubRepoOwner, gitHubRepo, settings);
351345
}
352346
});
@@ -367,7 +361,7 @@ Task("Publish-GitHub-Release")
367361
{
368362
if(string.IsNullOrEmpty(gitHubUserName)) throw new InvalidOperationException("Could not resolve GitHub user name.");
369363
if(string.IsNullOrEmpty(gitHubPassword)) throw new InvalidOperationException("Could not resolve GitHub password.");
370-
364+
371365
GitReleaseManagerClose(gitHubUserName, gitHubPassword, gitHubRepoOwner, gitHubRepo, milestone);
372366
}
373367
});
@@ -378,28 +372,29 @@ Task("Generate-Benchmark-Report")
378372
.Does(() =>
379373
{
380374
var publishDirectory = $"{benchmarkDir}Publish/";
375+
var publishedAppLocation = MakeAbsolute(File($"{publishDirectory}{libraryName}.Benchmark.exe")).FullPath;
376+
var artifactsLocation = MakeAbsolute(File(benchmarkDir)).FullPath;
381377

382-
DotNetCorePublish(benchmarkProject, new DotNetCorePublishSettings
383-
{
384-
Configuration = configuration,
378+
DotNetCorePublish(benchmarkProject, new DotNetCorePublishSettings
379+
{
380+
Configuration = configuration,
385381
NoRestore = true,
386382
NoBuild = true,
387-
OutputDirectory = publishDirectory
388-
});
389-
390-
var assemblyLocation = MakeAbsolute(File($"{publishDirectory}{libraryName}.Benchmark.dll")).FullPath;
391-
var artifactsLocation = MakeAbsolute(File(benchmarkDir)).FullPath;
392-
var benchmarkToolLocation = Context.Tools.Resolve("dotnet-benchmark.exe");
383+
OutputDirectory = publishDirectory
384+
});
393385

394-
var processResult = StartProcess(
395-
benchmarkToolLocation,
396-
new ProcessSettings()
397-
{
398-
Arguments = $"{assemblyLocation} -f * --artifacts={artifactsLocation}"
399-
});
400-
if (processResult != 0)
386+
using (DiagnosticVerbosity())
401387
{
402-
throw new Exception($"dotnet-benchmark.exe did not complete successfully. Result code: {processResult}");
388+
var processResult = StartProcess(
389+
publishedAppLocation,
390+
new ProcessSettings()
391+
{
392+
Arguments = $"-f * --artifacts={artifactsLocation}"
393+
});
394+
if (processResult != 0)
395+
{
396+
throw new Exception($"dotnet-benchmark.exe did not complete successfully. Result code: {processResult}");
397+
}
403398
}
404399
});
405400

@@ -425,12 +420,12 @@ Task("Benchmark")
425420
});
426421

427422
Task("ReleaseNotes")
428-
.IsDependentOn("Create-Release-Notes");
423+
.IsDependentOn("Create-Release-Notes");
429424

430425
Task("AppVeyor")
431426
.IsDependentOn("Run-Code-Coverage")
432427
.IsDependentOn("Upload-Coverage-Result")
433-
//.IsDependentOn("Generate-Benchmark-Report")
428+
.IsDependentOn("Generate-Benchmark-Report")
434429
.IsDependentOn("Create-NuGet-Package")
435430
.IsDependentOn("Upload-AppVeyor-Artifacts")
436431
.IsDependentOn("Publish-MyGet")

0 commit comments

Comments
 (0)