Skip to content

Commit

Permalink
Revert [Profiler] Add garbage collections in profile (#3412) - quotes…
Browse files Browse the repository at this point in the history
… removed (#3437)

This reverts commit d22743d.
  • Loading branch information
lucaspimentel authored Nov 9, 2022
1 parent d22743d commit dd29d36
Show file tree
Hide file tree
Showing 31 changed files with 16 additions and 1,258 deletions.
39 changes: 0 additions & 39 deletions profiler/src/Demos/Samples.Computer01/ComputerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public class ComputerService
private IteratorComputation _iteratorComputation;
private GenericsAllocation _genericsAllocation;
private ContentionGenerator _contentionGenerator;
private GarbageCollections _garbageCollections;

#if NET6_0_OR_GREATER
private LinuxSignalHandler _linuxSignalHandler;
Expand Down Expand Up @@ -97,9 +96,6 @@ public void StartService(Scenario scenario, int nbThreads, int parameter)
StartLinuxSignalHandler();
break;
#endif
case Scenario.GarbageCollection:
StartGarbageCollections(parameter);
break;

default:
throw new ArgumentOutOfRangeException(nameof(scenario), $"Unsupported scenario #{_scenario}");
Expand Down Expand Up @@ -164,10 +160,6 @@ public void StopService()
StopLinuxSignalHandler();
break;
#endif

case Scenario.GarbageCollection:
StopGarbageCollections();
break;
}
}

Expand Down Expand Up @@ -234,9 +226,6 @@ public void Run(Scenario scenario, int iterations, int nbThreads, int parameter)
RunLinuxSignalHandler();
break;
#endif
case Scenario.GarbageCollection:
RunGarbageCollections(parameter);
break;

default:
throw new ArgumentOutOfRangeException(nameof(scenario), $"Unsupported scenario #{_scenario}");
Expand Down Expand Up @@ -327,17 +316,6 @@ private void StartLinuxSignalHandler()
_linuxSignalHandler.Start();
}
#endif
private void StartGarbageCollections(int parameter)
{
if (parameter == int.MaxValue)
{
// gen0 GC by default
parameter = 0;
}

_garbageCollections = new GarbageCollections(parameter);
_garbageCollections.Start();
}

private void StopComputer()
{
Expand Down Expand Up @@ -410,11 +388,6 @@ private void StopLinuxSignalHandler()
}
#endif

private void StopGarbageCollections()
{
_garbageCollections.Stop();
}

private void RunComputer()
{
using (var computer = new Computer<byte, KeyValuePair<char, KeyValuePair<int, KeyValuePair<float, object>>>>())
Expand Down Expand Up @@ -491,18 +464,6 @@ private void RunLinuxSignalHandler()
}
#endif

private void RunGarbageCollections(int parameter)
{
if (parameter == int.MaxValue)
{
// gen0 collection by default
parameter = 0;
}

var garbageCollections = new GarbageCollections(parameter);
garbageCollections.Run();
}

public class MySpecialClassA
{
}
Expand Down
85 changes: 0 additions & 85 deletions profiler/src/Demos/Samples.Computer01/GarbageCollections.cs

This file was deleted.

8 changes: 2 additions & 6 deletions profiler/src/Demos/Samples.Computer01/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ public enum Scenario
Iterator,
GenericsAllocation,
ContentionGenerator,
LinuxSignalHandler,
GarbageCollection
LinuxSignalHandler
}

public class Program
Expand All @@ -46,12 +45,9 @@ public static void Main(string[] args)
// 8: start n threads doing iterator calls in constructors
// 9: start n threads allocating array of Generic<int> in LOH
// 10: start n threads waiting on the same lock
// 11: linux signal handler
// 12: start garbage collections of a given generation
//
Console.WriteLine($"{Environment.NewLine}Usage:{Environment.NewLine} > {Process.GetCurrentProcess().ProcessName} " +
$"[--service] [--iterations <number of iterations to execute>] " +
$"[--scenario <0=all 1=computer 2=generics 3=wall time 4=pi computation 5=compute fibonacci 6=n sleeping threads 7=async calls 8=iterator calls 9=allocate array of Generic<int>> 10=threads competing for a lock 11=lunix signal handler 12=trigger garbage collections] " +
$"[--scenario <0=all 1=computer 2=generics 3=wall time 4=pi computation 5=compute fibonacci 6=n sleeping threads 7=async calls 8=iterator calls 9=allocate array of Generic<int>> 10=threads competing for a lock] " +
$"[--param <any number to pass to the scenario - used for contention duration for example>] " +
$"[--timeout <duration in seconds> | --run-infinitely]");
Console.WriteLine();
Expand Down
Loading

0 comments on commit dd29d36

Please sign in to comment.