Fix broken microbenchmarks (#1861).
This commit is contained in:
parent
6c0af445e5
commit
009759c7f6
|
|
@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Http.Features;
|
|||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||
{
|
||||
|
|
@ -84,7 +85,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
var frameContext = new FrameContext
|
||||
{
|
||||
ServiceContext = serviceContext,
|
||||
ConnectionInformation = new MockConnectionInformation()
|
||||
ConnectionInformation = new MockConnectionInformation
|
||||
{
|
||||
PipeFactory = new PipeFactory()
|
||||
}
|
||||
};
|
||||
|
||||
_frame = new Frame<object>(application: null, frameContext: frameContext);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
var frameContext = new FrameContext
|
||||
{
|
||||
ServiceContext = serviceContext,
|
||||
ConnectionInformation = new MockConnectionInformation(),
|
||||
ConnectionInformation = new MockConnectionInformation
|
||||
{
|
||||
PipeFactory = new PipeFactory()
|
||||
},
|
||||
TimeoutControl = new MockTimeoutControl()
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
|
||||
private TestFrame<object> MakeFrame()
|
||||
{
|
||||
var factory = new PipeFactory();
|
||||
var input = factory.Create();
|
||||
var output = factory.Create();
|
||||
var pipeFactory = new PipeFactory();
|
||||
var input = pipeFactory.Create();
|
||||
var output = pipeFactory.Create();
|
||||
|
||||
var serviceContext = new ServiceContext
|
||||
{
|
||||
|
|
@ -90,7 +90,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
var frame = new TestFrame<object>(application: null, context: new FrameContext
|
||||
{
|
||||
ServiceContext = serviceContext,
|
||||
ConnectionInformation = new MockConnectionInformation(),
|
||||
ConnectionInformation = new MockConnectionInformation
|
||||
{
|
||||
PipeFactory = pipeFactory
|
||||
},
|
||||
Input = input.Reader,
|
||||
Output = output
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
public IPEndPoint RemoteEndPoint { get; }
|
||||
public IPEndPoint LocalEndPoint { get; }
|
||||
|
||||
public PipeFactory PipeFactory { get; }
|
||||
public PipeFactory PipeFactory { get; set; }
|
||||
public bool RequiresDispatch { get; }
|
||||
public IScheduler InputWriterScheduler { get; }
|
||||
public IScheduler OutputReaderScheduler { get; }
|
||||
|
|
|
|||
|
|
@ -17,26 +17,30 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
|
||||
public Frame<object> Frame { get; set; }
|
||||
|
||||
public PipeFactory PipelineFactory { get; set; }
|
||||
public PipeFactory PipeFactory { get; set; }
|
||||
|
||||
[Setup]
|
||||
public void Setup()
|
||||
{
|
||||
PipeFactory = new PipeFactory();
|
||||
Pipe = PipeFactory.Create();
|
||||
|
||||
var serviceContext = new ServiceContext
|
||||
{
|
||||
HttpParserFactory = f => new HttpParser<FrameAdapter>(),
|
||||
ServerOptions = new KestrelServerOptions()
|
||||
ServerOptions = new KestrelServerOptions(),
|
||||
};
|
||||
var frameContext = new FrameContext
|
||||
{
|
||||
ServiceContext = serviceContext,
|
||||
ConnectionInformation = new MockConnectionInformation(),
|
||||
ConnectionInformation = new MockConnectionInformation
|
||||
{
|
||||
PipeFactory = PipeFactory
|
||||
},
|
||||
TimeoutControl = new MockTimeoutControl()
|
||||
};
|
||||
|
||||
Frame = new Frame<object>(application: null, frameContext: frameContext);
|
||||
PipelineFactory = new PipeFactory();
|
||||
Pipe = PipelineFactory.Create();
|
||||
}
|
||||
|
||||
[Benchmark(Baseline = true, OperationsPerInvoke = RequestParsingData.InnerLoopCount)]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Http.Internal;
|
|||
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http;
|
||||
using Microsoft.AspNetCore.Server.Kestrel.Internal.System.IO.Pipelines;
|
||||
|
||||
namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
||||
{
|
||||
|
|
@ -176,7 +177,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
var frameContext = new FrameContext
|
||||
{
|
||||
ServiceContext = serviceContext,
|
||||
ConnectionInformation = new MockConnectionInformation()
|
||||
ConnectionInformation = new MockConnectionInformation
|
||||
{
|
||||
PipeFactory = new PipeFactory()
|
||||
}
|
||||
};
|
||||
|
||||
var frame = new Frame<object>(application: null, frameContext: frameContext);
|
||||
|
|
|
|||
|
|
@ -110,9 +110,9 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
[Setup]
|
||||
public void Setup()
|
||||
{
|
||||
var factory = new PipeFactory();
|
||||
var input = factory.Create();
|
||||
var output = factory.Create();
|
||||
var pipeFactory = new PipeFactory();
|
||||
var input = pipeFactory.Create();
|
||||
var output = pipeFactory.Create();
|
||||
|
||||
var serviceContext = new ServiceContext
|
||||
{
|
||||
|
|
@ -125,7 +125,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Performance
|
|||
var frame = new TestFrame<object>(application: null, context: new FrameContext
|
||||
{
|
||||
ServiceContext = serviceContext,
|
||||
ConnectionInformation = new MockConnectionInformation(),
|
||||
ConnectionInformation = new MockConnectionInformation
|
||||
{
|
||||
PipeFactory = pipeFactory
|
||||
},
|
||||
TimeoutControl = new MockTimeoutControl(),
|
||||
Input = input.Reader,
|
||||
Output = output
|
||||
|
|
|
|||
Loading…
Reference in New Issue