diff --git a/src/BenchmarkDotNet/Engines/HostSignal.cs b/src/BenchmarkDotNet/Engines/HostSignal.cs
index f4a2f75a22..cf423d2268 100644
--- a/src/BenchmarkDotNet/Engines/HostSignal.cs
+++ b/src/BenchmarkDotNet/Engines/HostSignal.cs
@@ -7,6 +7,11 @@ public enum HostSignal
///
BeforeProcessStart,
+ ///
+ /// right after we start the benchmarking process
+ ///
+ AfterProcessStart,
+
///
/// before jitting, warmup
///
diff --git a/src/BenchmarkDotNet/Loggers/Broker.cs b/src/BenchmarkDotNet/Loggers/Broker.cs
index cec11a3091..dcec4c0d56 100644
--- a/src/BenchmarkDotNet/Loggers/Broker.cs
+++ b/src/BenchmarkDotNet/Loggers/Broker.cs
@@ -15,9 +15,7 @@ internal class Broker
{
private readonly ILogger logger;
private readonly Process process;
- private readonly IDiagnoser diagnoser;
private readonly AnonymousPipeServerStream inputFromBenchmark, acknowledgments;
- private readonly DiagnoserActionParameters diagnoserActionParameters;
private readonly ManualResetEvent finished;
public Broker(ILogger logger, Process process, IDiagnoser diagnoser,
@@ -25,10 +23,10 @@ public Broker(ILogger logger, Process process, IDiagnoser diagnoser,
{
this.logger = logger;
this.process = process;
- this.diagnoser = diagnoser;
+ this.Diagnoser = diagnoser;
this.inputFromBenchmark = inputFromBenchmark;
this.acknowledgments = acknowledgments;
- diagnoserActionParameters = new DiagnoserActionParameters(process, benchmarkCase, benchmarkId);
+ DiagnoserActionParameters = new DiagnoserActionParameters(process, benchmarkCase, benchmarkId);
finished = new ManualResetEvent(false);
Results = new List();
@@ -38,6 +36,10 @@ public Broker(ILogger logger, Process process, IDiagnoser diagnoser,
process.Exited += OnProcessExited;
}
+ internal IDiagnoser Diagnoser { get; }
+
+ internal DiagnoserActionParameters DiagnoserActionParameters { get; }
+
internal List Results { get; }
internal List PrefixedOutput { get; }
@@ -90,7 +92,7 @@ private void ProcessDataBlocking()
}
else if (Engine.Signals.TryGetSignal(line, out var signal))
{
- diagnoser?.Handle(signal, diagnoserActionParameters);
+ Diagnoser?.Handle(signal, DiagnoserActionParameters);
writer.WriteLine(Engine.Signals.Acknowledgment);
diff --git a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs
index 55815ed005..f8bea8236e 100644
--- a/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs
+++ b/src/BenchmarkDotNet/Toolchains/DotNetCli/DotNetCliExecutor.cs
@@ -83,9 +83,12 @@ private ExecuteResult Execute(BenchmarkCase benchmarkCase,
logger.WriteLineInfo($"// Execute: {process.StartInfo.FileName} {process.StartInfo.Arguments} in {process.StartInfo.WorkingDirectory}");
- diagnoser?.Handle(HostSignal.BeforeProcessStart, new DiagnoserActionParameters(process, benchmarkCase, benchmarkId));
+ diagnoser?.Handle(HostSignal.BeforeProcessStart, broker.DiagnoserActionParameters);
process.Start();
+
+ diagnoser?.Handle(HostSignal.AfterProcessStart, broker.DiagnoserActionParameters);
+
processOutputReader.BeginRead();
process.EnsureHighPriority(logger);
diff --git a/src/BenchmarkDotNet/Toolchains/Executor.cs b/src/BenchmarkDotNet/Toolchains/Executor.cs
index 145e527439..8fbce03516 100644
--- a/src/BenchmarkDotNet/Toolchains/Executor.cs
+++ b/src/BenchmarkDotNet/Toolchains/Executor.cs
@@ -79,6 +79,8 @@ private static ExecuteResult Execute(Process process, BenchmarkCase benchmarkCas
return new ExecuteResult(true, null, null, Array.Empty(), Array.Empty(), Array.Empty(), launchIndex);
}
+ broker.Diagnoser?.Handle(HostSignal.AfterProcessStart, broker.DiagnoserActionParameters);
+
processOutputReader.BeginRead();
process.EnsureHighPriority(logger);