Skip to content

Commit

Permalink
added thread count tracking to RemotePingPong (#5384)
Browse files Browse the repository at this point in the history
Added this to help diagnose throughput drops on .NET 6, which we suspect are related to dotnet/runtime#53471
  • Loading branch information
Aaronontheweb authored Nov 15, 2021
1 parent e27220a commit dc700b3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/benchmark/RemotePingPong/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private static void PrintSysInfo(){
Console.WriteLine();

//Print tables
Console.WriteLine("Num clients, Total [msg], Msgs/sec, Total [ms]");
Console.WriteLine("Num clients, Total [msg], Msgs/sec, Total [ms], Start Threads, End Threads");

_firstRun = false;
}
Expand Down Expand Up @@ -188,6 +188,8 @@ private static long GetTotalMessagesReceived(int numberOfClients, long numberOfR
PrintSysInfo();
}

var startThreads = Process.GetCurrentProcess().Threads.Count;

var sw = Stopwatch.StartNew();
receivers.ForEach(c =>
{
Expand All @@ -197,6 +199,8 @@ private static long GetTotalMessagesReceived(int numberOfClients, long numberOfR
var waiting = Task.WhenAll(tasks);
await Task.WhenAll(waiting);
sw.Stop();

var endThreads = Process.GetCurrentProcess().Threads.Count;

// force clean termination
await Task.WhenAll(new[] { system1.Terminate(), system2.Terminate() });
Expand All @@ -217,7 +221,7 @@ private static long GetTotalMessagesReceived(int numberOfClients, long numberOfR
}

Console.ForegroundColor = foregroundColor;
Console.WriteLine("{0,10},{1,8},{2,10},{3,11}", numberOfClients, totalMessagesReceived, throughput, sw.Elapsed.TotalMilliseconds.ToString("F2", CultureInfo.InvariantCulture));
Console.WriteLine("{0,10},{1,8},{2,10},{3,11}, {4,13}, {5,15}", numberOfClients, totalMessagesReceived, throughput, sw.Elapsed.TotalMilliseconds.ToString("F2", CultureInfo.InvariantCulture), startThreads, endThreads);
return (redCount <= 3, bestThroughput, redCount);
}

Expand Down

0 comments on commit dc700b3

Please sign in to comment.