Skip to content

Commit 5f30497

Browse files
committed
Cleanup code
1 parent d0fa087 commit 5f30497

File tree

11 files changed

+67
-85
lines changed

11 files changed

+67
-85
lines changed
Lines changed: 1 addition & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,6 @@
11
using System.Reflection;
22
using System.Runtime.InteropServices;
33

4-
// General Information about an assembly is controlled through the following
5-
// set of attributes. Change these attribute values to modify the information
6-
// associated with an assembly.
7-
84
[assembly: AssemblyTitle("Serilog.Sinks.Async.IntTests")]
95
[assembly: AssemblyDescription("")]
10-
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
12-
[assembly: AssemblyProduct("Serilog.Sinks.Async.IntTests")]
13-
[assembly: AssemblyCopyright("Copyright © 2016")]
14-
[assembly: AssemblyTrademark("")]
15-
[assembly: AssemblyCulture("")]
16-
17-
// Setting ComVisible to false makes the types in this assembly not visible
18-
// to COM components. If you need to access a type in this assembly from
19-
// COM, set the ComVisible attribute to true on that type.
20-
21-
[assembly: ComVisible(false)]
22-
23-
// The following GUID is for the ID of the typelib if this project is exposed to COM
24-
25-
[assembly: Guid("a6dda6cb-e4d9-4a40-aa91-eed61f987411")]
26-
27-
// Version information for an assembly consists of the following four values:
28-
//
29-
// Major Version
30-
// Minor Version
31-
// Build Number
32-
// Revision
33-
//
34-
// You can specify all the values or you can default the Build and Revision Numbers
35-
// by using the '*' as shown below:
36-
// [assembly: AssemblyVersion("1.0.*")]
37-
38-
[assembly: AssemblyVersion("1.0.0.0")]
39-
[assembly: AssemblyFileVersion("1.0.0.0")]
6+
[assembly: Guid("a6dda6cb-e4d9-4a40-aa91-eed61f987411")]

src/Serilog.Sinks.Async.IntTests/Serilog.Sinks.Async.IntTests.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
</Otherwise>
6161
</Choose>
6262
<ItemGroup>
63+
<Compile Include="..\GlobalAssemblyInfo.cs">
64+
<Link>Properties\GlobalAssemblyInfo.cs</Link>
65+
</Compile>
6366
<Compile Include="MemorySink.cs" />
6467
<Compile Include="SinkSpec.cs" />
6568
<Compile Include="AsyncSpec.cs" />

src/Serilog.Sinks.Async.PerformanceTests/Benchmarks.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using BenchmarkDotNet.Running;
1+
using BenchmarkDotNet.Running;
32
using Microsoft.VisualStudio.TestTools.UnitTesting;
43

54
namespace Serilog.Sinks.Async.PerformanceTests
@@ -13,4 +12,4 @@ public void Benchmark()
1312
BenchmarkRunner.Run<ThroughputBenchmark>();
1413
}
1514
}
16-
}
15+
}
Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,6 @@
11
using System.Reflection;
2-
using System.Runtime.CompilerServices;
32
using System.Runtime.InteropServices;
43

5-
// General Information about an assembly is controlled through the following
6-
// set of attributes. Change these attribute values to modify the information
7-
// associated with an assembly.
84
[assembly: AssemblyTitle("Serilog.Sinks.Async.PerformanceTests")]
95
[assembly: AssemblyDescription("")]
10-
[assembly: AssemblyConfiguration("")]
11-
[assembly: AssemblyCompany("")]
12-
[assembly: AssemblyProduct("Serilog.Sinks.Async.PerformanceTests")]
13-
[assembly: AssemblyCopyright("Copyright © 2016")]
14-
[assembly: AssemblyTrademark("")]
15-
[assembly: AssemblyCulture("")]
16-
17-
// Setting ComVisible to false makes the types in this assembly not visible
18-
// to COM components. If you need to access a type in this assembly from
19-
// COM, set the ComVisible attribute to true on that type.
20-
[assembly: ComVisible(false)]
21-
22-
// The following GUID is for the ID of the typelib if this project is exposed to COM
23-
[assembly: Guid("b7e8a281-b017-43c3-956d-905ea74f0484")]
24-
25-
// Version information for an assembly consists of the following four values:
26-
//
27-
// Major Version
28-
// Minor Version
29-
// Build Number
30-
// Revision
31-
//
32-
// You can specify all the values or you can default the Build and Revision Numbers
33-
// by using the '*' as shown below:
34-
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
6+
[assembly: Guid("b7e8a281-b017-43c3-956d-905ea74f0484")]

src/Serilog.Sinks.Async.PerformanceTests/Serilog.Sinks.Async.PerformanceTests.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,17 @@
88
<AppDesignerFolder>Properties</AppDesignerFolder>
99
<RootNamespace>Serilog.Sinks.Async.PerformanceTests</RootNamespace>
1010
<AssemblyName>Serilog.Sinks.Async.PerformanceTests</AssemblyName>
11-
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
1212
<FileAlignment>512</FileAlignment>
1313
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1414
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
1515
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
1616
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
1717
<IsCodedUITest>False</IsCodedUITest>
1818
<TestProjectType>UnitTest</TestProjectType>
19+
<TargetFrameworkProfile />
20+
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
21+
<RestorePackages>true</RestorePackages>
1922
</PropertyGroup>
2023
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
2124
<DebugSymbols>true</DebugSymbols>
@@ -76,6 +79,9 @@
7679
</Otherwise>
7780
</Choose>
7881
<ItemGroup>
82+
<Compile Include="..\GlobalAssemblyInfo.cs">
83+
<Link>Properties\GlobalAssemblyInfo.cs</Link>
84+
</Compile>
7985
<Compile Include="Benchmarks.cs" />
8086
<Compile Include="Properties\AssemblyInfo.cs" />
8187
<Compile Include="SignallingSink.cs" />
@@ -114,6 +120,13 @@
114120
</Choose>
115121
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
116122
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
123+
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
124+
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
125+
<PropertyGroup>
126+
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
127+
</PropertyGroup>
128+
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
129+
</Target>
117130
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
118131
Other similar extension points exist, see Microsoft.Common.targets.
119132
<Target Name="BeforeBuild">
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<ProjectConfiguration>
2+
<AutoDetectNugetBuildDependencies>true</AutoDetectNugetBuildDependencies>
3+
<BuildPriority>1000</BuildPriority>
4+
<CopyReferencedAssembliesToWorkspace>false</CopyReferencedAssembliesToWorkspace>
5+
<ConsiderInconclusiveTestsAsPassing>false</ConsiderInconclusiveTestsAsPassing>
6+
<PreloadReferencedAssemblies>false</PreloadReferencedAssemblies>
7+
<AllowDynamicCodeContractChecking>true</AllowDynamicCodeContractChecking>
8+
<AllowStaticCodeContractChecking>false</AllowStaticCodeContractChecking>
9+
<AllowCodeAnalysis>false</AllowCodeAnalysis>
10+
<IgnoreThisComponentCompletely>false</IgnoreThisComponentCompletely>
11+
<RunPreBuildEvents>false</RunPreBuildEvents>
12+
<RunPostBuildEvents>false</RunPostBuildEvents>
13+
<PreviouslyBuiltSuccessfully>true</PreviouslyBuiltSuccessfully>
14+
<InstrumentAssembly>true</InstrumentAssembly>
15+
<PreventSigningOfAssembly>false</PreventSigningOfAssembly>
16+
<AnalyseExecutionTimes>true</AnalyseExecutionTimes>
17+
<DetectStackOverflow>true</DetectStackOverflow>
18+
<IncludeStaticReferencesInWorkspace>true</IncludeStaticReferencesInWorkspace>
19+
<DefaultTestTimeout>60000</DefaultTestTimeout>
20+
<UseBuildConfiguration />
21+
<UseBuildPlatform />
22+
<ProxyProcessPath />
23+
<UseCPUArchitecture>AutoDetect</UseCPUArchitecture>
24+
<MSTestThreadApartmentState>STA</MSTestThreadApartmentState>
25+
<BuildProcessArchitecture>x86</BuildProcessArchitecture>
26+
</ProjectConfiguration>

src/Serilog.Sinks.Async.PerformanceTests/SignallingSink.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,30 @@
55

66
namespace Serilog.Sinks.Async.PerformanceTests
77
{
8-
class SignallingSink : ILogEventSink
8+
internal class SignallingSink : ILogEventSink
99
{
10-
readonly int _expectedCount;
11-
int _current;
12-
readonly ManualResetEvent _wh;
10+
private readonly int _expectedCount;
11+
private readonly ManualResetEvent _wh;
12+
private int _current;
1313

1414
public SignallingSink(int expectedCount)
1515
{
1616
_expectedCount = expectedCount;
1717
_wh = new ManualResetEvent(false);
1818
}
1919

20-
public void Reset()
21-
{
22-
_wh.Reset();
23-
_current = 0;
24-
}
25-
2620
public void Emit(LogEvent logEvent)
2721
{
2822
if (Interlocked.Increment(ref _current) == _expectedCount)
2923
_wh.Set();
3024
}
3125

26+
public void Reset()
27+
{
28+
_wh.Reset();
29+
_current = 0;
30+
}
31+
3232
public void Wait()
3333
{
3434
if (!_wh.WaitOne(60000))

src/Serilog.Sinks.Async.PerformanceTests/ThroughputBenchmark.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ namespace Serilog.Sinks.Async.PerformanceTests
77
{
88
public class ThroughputBenchmark
99
{
10-
readonly ILogger _syncLogger, _asyncLogger;
11-
readonly SignallingSink _signal;
12-
readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null, new MessageTemplate(new[] { new TextToken("Hello") }), new LogEventProperty[0]);
10+
private const int Count = 10000;
1311

14-
const int Count = 10000;
12+
private readonly LogEvent _evt = new LogEvent(DateTimeOffset.Now, LogEventLevel.Information, null,
13+
new MessageTemplate(new[] {new TextToken("Hello")}), new LogEventProperty[0]);
14+
15+
private readonly SignallingSink _signal;
16+
private readonly ILogger _syncLogger, _asyncLogger;
1517

1618
public ThroughputBenchmark()
1719
{
@@ -55,4 +57,4 @@ public void Async()
5557
_signal.Wait();
5658
}
5759
}
58-
}
60+
}

src/Serilog.Sinks.Async.PerformanceTests/packages.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
2+
23
<packages>
34
<package id="BenchmarkDotNet" version="0.9.8" targetFramework="net452" />
45
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net452" />

src/Serilog.Sinks.Async/BufferedQueueSink.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,4 @@ public void StartConsumer(Action<LogEvent> action)
6767
});
6868
}
6969
}
70-
}
70+
}

0 commit comments

Comments
 (0)