Skip to content

Commit 0724ba2

Browse files
author
Bart Koelman
committed
cibuild fixes
1 parent a231651 commit 0724ba2

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

src/Examples/JsonApiDotNetCoreExample/Startups/EmptyStartup.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public virtual void ConfigureServices(IServiceCollection services)
1515
{
1616
}
1717

18+
// ReSharper disable once UnusedMemberInSuper.Global
19+
// ReSharper disable once UnusedParameter.Global
1820
public virtual void Configure(IApplicationBuilder app, IWebHostEnvironment environment, ILoggerFactory loggerFactory)
1921
{
2022
}

src/JsonApiDotNetCore/Diagnostics/CascadingCodeTimer.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.Diagnostics;
45
using System.Globalization;
56
using System.Linq;
@@ -21,16 +22,23 @@ public sealed class CascadingCodeTimer : ICodeTimer
2122

2223
static CascadingCodeTimer()
2324
{
24-
// Be default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer.
25-
// The steps below ensure to get an accuracy of 0.1%-0.2%. With this accuracy, algorithms can be tested and compared.
26-
// https://www.codeproject.com/Articles/61964/Performance-Tests-Precise-Run-Time-Measurements-wi
25+
try
26+
{
27+
// Be default, measurements using Stopwatch can differ 25%-30% on the same function on the same computer.
28+
// The steps below ensure to get an accuracy of 0.1%-0.2%. With this accuracy, algorithms can be tested and compared.
29+
// https://www.codeproject.com/Articles/61964/Performance-Tests-Precise-Run-Time-Measurements-wi
2730

28-
// The most important thing is to prevent switching between CPU cores or processors. Switching dismisses the cache, etc. and has a huge performance impact on the test.
29-
Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(2);
31+
// The most important thing is to prevent switching between CPU cores or processors. Switching dismisses the cache, etc. and has a huge performance impact on the test.
32+
Process.GetCurrentProcess().ProcessorAffinity = new IntPtr(2);
3033

31-
// To get the CPU core more exclusively, we must prevent that other threads can use this CPU core. We set our process and thread priority to achieve this.
32-
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
33-
Thread.CurrentThread.Priority = ThreadPriority.Highest;
34+
// To get the CPU core more exclusively, we must prevent that other threads can use this CPU core. We set our process and thread priority to achieve this.
35+
Process.GetCurrentProcess().PriorityClass = ProcessPriorityClass.High;
36+
Thread.CurrentThread.Priority = ThreadPriority.Highest;
37+
}
38+
catch (Win32Exception exception)
39+
{
40+
Console.WriteLine("*** Process setup failed: " + exception);
41+
}
3442
}
3543

3644
/// <inheritdoc />

0 commit comments

Comments
 (0)