Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion profiler/src/Demos/Samples.Computer01/AppDomainCrash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ private static void Worker()
// Use the exception profiler to capture callstack
throw new CatException("Fluff");
}
catch // just swallow
catch
{
// just swallow
}
}

Expand Down
20 changes: 20 additions & 0 deletions profiler/src/Demos/Samples.Computer01/ComputerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class ComputerService
#if NETFRAMEWORK
private AppDomainCrash _appDomainCrash;
#endif
private ReferenceChainScenarios _referenceChainScenarios;

public void StartService(Scenario scenario, int nbThreads, int parameter)
{
Expand Down Expand Up @@ -206,6 +207,11 @@ public void StartService(Scenario scenario, int nbThreads, int parameter)
break;
#endif

case Scenario.ReferenceChain:
_referenceChainScenarios = new ReferenceChainScenarios(parameter);
_referenceChainScenarios.Start();
break;

default:
throw new ArgumentOutOfRangeException(nameof(scenario), $"Unsupported scenario #{_scenario}");
}
Expand Down Expand Up @@ -349,6 +355,10 @@ public void StopService()
_appDomainCrash.Stop();
break;
#endif

case Scenario.ReferenceChain:
_referenceChainScenarios.Stop();
break;
}
}

Expand Down Expand Up @@ -493,6 +503,10 @@ public void Run(Scenario scenario, int iterations, int nbThreads, int parameter)
RunAppDomainCrash(parameter);
break;
#endif
case Scenario.ReferenceChain:
RunReferenceChain(parameter);
break;

default:
throw new ArgumentOutOfRangeException(nameof(scenario), $"Unsupported scenario #{_scenario}");
}
Expand Down Expand Up @@ -1030,6 +1044,12 @@ private void RunAppDomainCrash(int nbAppDomains)
}
#endif

private void RunReferenceChain(int scenarioNumber)
{
var test = new ReferenceChainScenarios(scenarioNumber);
test.Run();
}

public class MySpecialClassA
{
}
Expand Down
4 changes: 4 additions & 0 deletions profiler/src/Demos/Samples.Computer01/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public enum Scenario
SyncOverAsyncWithResult,
SyncOverAsyncWithGetAwaiterGetResult,
AppDomainCrash,
ReferenceChain, // parameter = scenario number (1-7)
}

public class Program
Expand Down Expand Up @@ -104,6 +105,9 @@ public static void Main(string[] args)
// - interactively for debugging
var computerService = new ComputerService();

// Console.WriteLine("Press ENTER to start...");
// Console.ReadLine();

if (runAsService)
{
computerService.RunAsService(timeout, scenario, parameter);
Expand Down
Loading
Loading