Skip to content

Commit

Permalink
Update EventPipeStress (#3049)
Browse files Browse the repository at this point in the history
  • Loading branch information
John Salem authored May 7, 2022
1 parent 1785c88 commit 519a60c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/tests/EventPipeStress/Orchestrator/Orchestrator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
9 changes: 7 additions & 2 deletions src/tests/EventPipeStress/Orchestrator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Microsoft.Diagnostics.Tracing;

using Process = System.Diagnostics.Process;
using System.Runtime.Versioning;

namespace Orchestrator
{
Expand Down Expand Up @@ -191,6 +192,10 @@ static Func<int, TestResult> UseFS(bool rundown, int bufferSize)
};
}

[SupportedOSPlatformGuard("Windows")]
[SupportedOSPlatformGuard("Linux")]
static bool IsWindowsOrLinux => OperatingSystem.IsLinux() || OperatingSystem.IsWindows();

static async Task<int> Orchestrate(
IConsole console,
CancellationToken ct,
Expand Down Expand Up @@ -254,7 +259,8 @@ static async Task<int> Orchestrate(
eventWritingProc.Start();

Console.WriteLine($"Executing: {eventWritingProc.StartInfo.FileName} {eventWritingProc.StartInfo.Arguments}");
if (!RuntimeInformation.IsOSPlatform(OSPlatform.OSX))

if (IsWindowsOrLinux)
{
// Set affinity and priority
ulong affinityMask = 0;
Expand All @@ -263,7 +269,6 @@ static async Task<int> Orchestrate(
affinityMask |= ((ulong)1 << j);
}
eventWritingProc.ProcessorAffinity = (IntPtr)((ulong)eventWritingProc.ProcessorAffinity & affinityMask);
eventWritingProc.PriorityClass = ProcessPriorityClass.RealTime; // Set the process priority to highest possible
}

// Start listening to the event.
Expand Down
2 changes: 1 addition & 1 deletion src/tests/EventPipeStress/Stress/Stress.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 519a60c

Please sign in to comment.