forked from serilog/serilog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ffb7ce4
commit bc44501
Showing
16 changed files
with
325 additions
and
457 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,16 @@ | ||
Push-Location $PSScriptRoot | ||
|
||
if(Test-Path .\artifacts) { Remove-Item .\artifacts -Force -Recurse } | ||
./Build.ps1 | ||
|
||
& dotnet restore | ||
foreach ($test in ls test/*.PerformanceTests) { | ||
Push-Location $test | ||
|
||
$revision = @{ $true = $env:APPVEYOR_BUILD_NUMBER; $false = 1 }[$env:APPVEYOR_BUILD_NUMBER -ne $NULL]; | ||
echo "perf: Running performance test project in $test" | ||
|
||
Push-Location src/Serilog | ||
& dotnet test -c Release | ||
if($LASTEXITCODE -ne 0) { exit 2 } | ||
|
||
& dotnet build -c Release -o ..\..\.\artifacts --version-suffix=$revision | ||
if($LASTEXITCODE -ne 0) { exit 1 } | ||
|
||
Pop-Location | ||
Push-Location test/Serilog.PerformanceTests | ||
|
||
& dotnet test -c Release | ||
if($LASTEXITCODE -ne 0) { exit 2 } | ||
Pop-Location | ||
} | ||
|
||
Pop-Location | ||
Pop-Location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
99 changes: 0 additions & 99 deletions
99
test/Serilog.PerformanceTests/FromLogContextPushPropertyTests.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using BenchmarkDotNet.Attributes; | ||
using BenchmarkDotNet.Running; | ||
using Serilog; | ||
using Serilog.Core; | ||
using Serilog.Events; | ||
using System; | ||
using Serilog.PerformanceTests.Support; | ||
using Xunit; | ||
|
||
namespace Serilog.PerformanceTests | ||
{ | ||
/// <summary> | ||
/// Tests the overhead of determining the active logging level. | ||
/// </summary> | ||
public class LevelControlBenchmark | ||
{ | ||
ILogger _off, _levelSwitchOff, _minLevel, _levelSwitch; | ||
readonly LogEvent _event = Some.InformationEvent(); | ||
|
||
[Setup] | ||
public void Setup() | ||
{ | ||
_off = new LoggerConfiguration() | ||
.MinimumLevel.Fatal() | ||
.WriteTo.Sink(new NullSink()) | ||
.CreateLogger(); | ||
_levelSwitchOff = new LoggerConfiguration() | ||
.MinimumLevel.ControlledBy(new LoggingLevelSwitch(LogEventLevel.Fatal)) | ||
.WriteTo.Sink(new NullSink()) | ||
.CreateLogger(); | ||
_minLevel = new LoggerConfiguration() | ||
.MinimumLevel.Information() | ||
.WriteTo.Sink(new NullSink()) | ||
.CreateLogger(); | ||
_levelSwitch = new LoggerConfiguration() | ||
.MinimumLevel.ControlledBy(new LoggingLevelSwitch(LogEventLevel.Information)) | ||
.WriteTo.Sink(new NullSink()) | ||
.CreateLogger(); | ||
} | ||
|
||
[Benchmark(Baseline = true)] | ||
public void Off() | ||
{ | ||
_off.Write(_event); | ||
} | ||
|
||
[Benchmark] | ||
public void LevelSwitchOff() | ||
{ | ||
_levelSwitchOff.Write(_event); | ||
} | ||
|
||
[Benchmark] | ||
public void MinimumLevelOn() | ||
{ | ||
_minLevel.Write(_event); | ||
} | ||
|
||
[Benchmark] | ||
public void LevelSwitchOn() | ||
{ | ||
_levelSwitch.Write(_event); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.