Remove custom BenchmarkDotNet toolchain.
This commit is contained in:
parent
4fd71e3a6b
commit
0dca3a266f
|
|
@ -33,3 +33,4 @@ runtimes/
|
||||||
launchSettings.json
|
launchSettings.json
|
||||||
BenchmarkDotNet.Artifacts/
|
BenchmarkDotNet.Artifacts/
|
||||||
BDN.Generated/
|
BDN.Generated/
|
||||||
|
binaries/
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||||
.With(RunStrategy.Throughput)
|
.With(RunStrategy.Throughput)
|
||||||
.WithLaunchCount(3)
|
.WithLaunchCount(3)
|
||||||
.WithWarmupCount(5)
|
.WithWarmupCount(5)
|
||||||
.WithTargetCount(10)
|
.WithTargetCount(10));
|
||||||
.With(new MsBuildToolchain()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using BenchmarkDotNet.Characteristics;
|
|
||||||
using BenchmarkDotNet.Diagnosers;
|
|
||||||
using BenchmarkDotNet.Extensions;
|
|
||||||
using BenchmarkDotNet.Jobs;
|
|
||||||
using BenchmarkDotNet.Loggers;
|
|
||||||
using BenchmarkDotNet.Running;
|
|
||||||
using BenchmarkDotNet.Toolchains;
|
|
||||||
using BenchmarkDotNet.Toolchains.DotNetCli;
|
|
||||||
using BenchmarkDotNet.Toolchains.Results;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|
||||||
{
|
|
||||||
public class MsBuildExecutor : IExecutor
|
|
||||||
{
|
|
||||||
public ExecuteResult Execute(BuildResult buildResult, Benchmark benchmark, ILogger logger, IResolver resolver, IDiagnoser diagnoser = null)
|
|
||||||
{
|
|
||||||
var workingDirectory = buildResult.ArtifactsPaths.BuildArtifactsDirectoryPath;
|
|
||||||
|
|
||||||
using (var process = new Process { StartInfo = BuildDotNetProcessStartInfo(workingDirectory) })
|
|
||||||
{
|
|
||||||
var loggerDiagnoserType = typeof(Toolchain).GetTypeInfo().Assembly.GetType("BenchmarkDotNet.Loggers.SynchronousProcessOutputLoggerWithDiagnoser");
|
|
||||||
var loggerDiagnoser = Activator.CreateInstance(
|
|
||||||
loggerDiagnoserType,
|
|
||||||
new object[] { logger, process, diagnoser, benchmark });
|
|
||||||
|
|
||||||
process.Start();
|
|
||||||
|
|
||||||
var processInputMethodInfo = loggerDiagnoser.GetType().GetMethod("ProcessInput", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
||||||
processInputMethodInfo.Invoke(loggerDiagnoser, null);
|
|
||||||
|
|
||||||
process.WaitForExit();
|
|
||||||
|
|
||||||
if (process.ExitCode != 0)
|
|
||||||
{
|
|
||||||
return new ExecuteResult(true, process.ExitCode, new string[0], new string[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
var linesWithResults = (IReadOnlyList<string>)loggerDiagnoserType
|
|
||||||
.GetProperty("LinesWithResults", BindingFlags.Instance | BindingFlags.NonPublic)
|
|
||||||
.GetValue(loggerDiagnoser, null);
|
|
||||||
var linesWithExtraOutput = (IReadOnlyList<string>)loggerDiagnoserType
|
|
||||||
.GetProperty("LinesWithExtraOutput", BindingFlags.Instance | BindingFlags.NonPublic)
|
|
||||||
.GetValue(loggerDiagnoser, null);
|
|
||||||
|
|
||||||
return new ExecuteResult(true, process.ExitCode, linesWithResults, linesWithExtraOutput);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ProcessStartInfo BuildDotNetProcessStartInfo(string workingDirectory)
|
|
||||||
=> new ProcessStartInfo
|
|
||||||
{
|
|
||||||
FileName = "dotnet",
|
|
||||||
WorkingDirectory = workingDirectory,
|
|
||||||
Arguments = "binaries/Benchmark.Generated.dll",
|
|
||||||
UseShellExecute = false,
|
|
||||||
CreateNoWindow = true,
|
|
||||||
RedirectStandardOutput = true,
|
|
||||||
RedirectStandardError = true
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using BenchmarkDotNet.Characteristics;
|
|
||||||
using BenchmarkDotNet.Environments;
|
|
||||||
using BenchmarkDotNet.Helpers;
|
|
||||||
using BenchmarkDotNet.Jobs;
|
|
||||||
using BenchmarkDotNet.Running;
|
|
||||||
using BenchmarkDotNet.Toolchains;
|
|
||||||
using BenchmarkDotNet.Toolchains.DotNetCli;
|
|
||||||
using System.Reflection;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|
||||||
{
|
|
||||||
public class MsBuildGenerator : DotNetCliGenerator
|
|
||||||
{
|
|
||||||
public MsBuildGenerator()
|
|
||||||
: base("netcoreapp1.1", null, (Func<Platform, string>) (_ => "x64"), null, null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override string GetProjectFilePath(string binariesDirectoryPath)
|
|
||||||
=> Path.Combine(binariesDirectoryPath, "Benchmark.Generated.csproj");
|
|
||||||
|
|
||||||
protected override void GenerateProject(Benchmark benchmark, ArtifactsPaths artifactsPaths, IResolver resolver)
|
|
||||||
{
|
|
||||||
var projectTemplate = @"<Project Sdk=""Microsoft.NET.Sdk"" ToolsVersion=""15.0"">
|
|
||||||
|
|
||||||
<Import Project=""..\build\common.props"" />
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFramework>netcoreapp1.1</TargetFramework>
|
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Compile Include=""$CODEFILENAME$"" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include=""..\test\Microsoft.AspNetCore.Server.Kestrel.Performance\Microsoft.AspNetCore.Server.Kestrel.Performance.csproj"" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>";
|
|
||||||
|
|
||||||
var projectContent = SetCodeFileName(projectTemplate, Path.GetFileName(artifactsPaths.ProgramCodePath));
|
|
||||||
File.WriteAllText(artifactsPaths.ProjectFilePath, projectContent);
|
|
||||||
|
|
||||||
var runtimeConfigContent = @"
|
|
||||||
{
|
|
||||||
""configProperties"": {
|
|
||||||
""System.GC.Server"": true
|
|
||||||
}
|
|
||||||
}";
|
|
||||||
File.WriteAllText(Path.Combine(artifactsPaths.BuildArtifactsDirectoryPath, "runtimeConfig.template.json"), runtimeConfigContent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
// Copyright (c) .NET Foundation. All rights reserved.
|
|
||||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using BenchmarkDotNet.Characteristics;
|
|
||||||
using BenchmarkDotNet.Environments;
|
|
||||||
using BenchmarkDotNet.Jobs;
|
|
||||||
using BenchmarkDotNet.Loggers;
|
|
||||||
using BenchmarkDotNet.Running;
|
|
||||||
using BenchmarkDotNet.Toolchains;
|
|
||||||
using BenchmarkDotNet.Toolchains.Core;
|
|
||||||
using BenchmarkDotNet.Toolchains.DotNetCli;
|
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|
||||||
{
|
|
||||||
public class MsBuildToolchain : Toolchain
|
|
||||||
{
|
|
||||||
private const string TargetFrameworkMoniker = "netcoreapp1.1";
|
|
||||||
|
|
||||||
public MsBuildToolchain()
|
|
||||||
: base("MsBuildCore",
|
|
||||||
new MsBuildGenerator(),
|
|
||||||
new DotNetCliBuilder(TargetFrameworkMoniker),
|
|
||||||
new MsBuildExecutor())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue