Skip to content

Commit 6b02312

Browse files
authored
enable collecting dump for gcperfsim-functional test (#4910)
1 parent 05d29ee commit 6b02312

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/GCPerfSim/GCPerfSimCommand.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ internal static Dictionary<string, ProcessExecutionDetails> ExecuteLocally(GCPer
114114

115115
for (int iterationIdx = 0; iterationIdx < configuration.Environment.Iterations; iterationIdx++)
116116
{
117+
// Format: (Name of Run).(corerun / name of corerun).(IterationIdx)
118+
string key = $"{runInfo.RunDetails.Key}.{runInfo.CorerunDetails.Key}.{iterationIdx}";
117119
using (Process gcperfsimProcess = new())
118120
{
119121
gcperfsimProcess.StartInfo.FileName = processAndParameters.Item1;
@@ -155,6 +157,10 @@ internal static Dictionary<string, ProcessExecutionDetails> ExecuteLocally(GCPer
155157
}
156158
}
157159

160+
// Set dump name
161+
string dumpPath = Path.Combine(outputPath, key + ".dmp");
162+
environmentVariables["DOTNET_DbgMiniDumpName"] = dumpPath;
163+
158164
// Check if the log file is specified, also store it in a run-specific location.
159165
// This log file should be named in concordance with the name of the run and the benchmark.
160166
const string gclogVariable = "DOTNET_GCLogFile";
@@ -170,13 +176,10 @@ internal static Dictionary<string, ProcessExecutionDetails> ExecuteLocally(GCPer
170176
gcperfsimProcess.StartInfo.EnvironmentVariables[environVar.Key] = environVar.Value;
171177
}
172178

173-
// Format: (Name of Run).(corerun / name of corerun).(IterationIdx)
174179
string? output = null;
175180
string? error = null;
176181

177-
string key = $"{runInfo.RunDetails.Key}.{runInfo.CorerunDetails.Key}.{iterationIdx}";
178-
string traceName = $"{runInfo.RunDetails.Key}.{runInfo.CorerunDetails.Key}.{iterationIdx}";
179-
using (TraceCollector traceCollector = new TraceCollector(traceName, collectType, outputPath))
182+
using (TraceCollector traceCollector = new TraceCollector(key, collectType, outputPath))
180183
{
181184
gcperfsimProcess.Start();
182185
output = gcperfsimProcess.StandardOutput.ReadToEnd();
@@ -189,7 +192,7 @@ internal static Dictionary<string, ProcessExecutionDetails> ExecuteLocally(GCPer
189192
if (configuration.TraceConfigurations?.Type != "none")
190193
{
191194
// Not checking Linux here since the local run only allows for Windows.
192-
if (!File.Exists(Path.Combine(outputPath, traceName + ".etl.zip")))
195+
if (!File.Exists(Path.Combine(outputPath, key + ".etl.zip")))
193196
{
194197
AnsiConsole.MarkupLine($"[yellow bold] ({DateTime.Now}) The trace for the run wasn't successfully captured. Please check the log file for more details: {Markup.Escape(output)} Full run details: {Path.GetFileNameWithoutExtension(configuration.Name)}: {runInfo.CorerunDetails.Key} for {runInfo.RunDetails.Key} [/]");
195198
}

src/benchmarks/gc/GC.Infrastructure/GC.Infrastructure/Commands/GCPerfSim/GCPerfSimFunctionalCommand.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,30 +360,34 @@ private void CreateLargePages_WorkstationSuite(string gcPerfSimSuitePath, GCPerf
360360

361361
private GCPerfSimConfiguration CreateBasicGCPerfSimConfiguration(GCPerfSimFunctionalConfiguration configuration)
362362
{
363-
GCPerfSimConfiguration gcPerfSimNormalWorkstationConfiguration = GCPerfSimConfigurationParser.Parse(_gcPerfSimBase, true);
363+
GCPerfSimConfiguration gcPerfSimBasicConfiguration = GCPerfSimConfigurationParser.Parse(_gcPerfSimBase, true);
364364

365365
// modify gcperfsim_configurations
366-
gcPerfSimNormalWorkstationConfiguration.gcperfsim_configurations.gcperfsim_path =
366+
gcPerfSimBasicConfiguration.gcperfsim_configurations.gcperfsim_path =
367367
configuration.gcperfsim_path;
368368

369369
// modify coreruns
370-
gcPerfSimNormalWorkstationConfiguration.coreruns = new Dictionary<string, CoreRunInfo>();
370+
gcPerfSimBasicConfiguration.coreruns = new Dictionary<string, CoreRunInfo>();
371371
foreach (var keyValuePair in configuration.coreruns)
372372
{
373-
gcPerfSimNormalWorkstationConfiguration.coreruns[keyValuePair.Key] = keyValuePair.Value;
373+
gcPerfSimBasicConfiguration.coreruns[keyValuePair.Key] = keyValuePair.Value;
374374
}
375375

376376
// modify trace_configurations
377-
gcPerfSimNormalWorkstationConfiguration.TraceConfigurations.Type = configuration.trace_configuration_type;
377+
gcPerfSimBasicConfiguration.TraceConfigurations.Type = configuration.trace_configuration_type;
378378

379379
// load environment variables by deep copying them.
380-
gcPerfSimNormalWorkstationConfiguration.Environment.environment_variables = new Dictionary<string, string>();
380+
gcPerfSimBasicConfiguration.Environment.environment_variables = new Dictionary<string, string>();
381381
foreach (var c in configuration.Environment.environment_variables)
382382
{
383-
gcPerfSimNormalWorkstationConfiguration.Environment.environment_variables[c.Key] = c.Value;
383+
gcPerfSimBasicConfiguration.Environment.environment_variables[c.Key] = c.Value;
384384
}
385385

386-
return gcPerfSimNormalWorkstationConfiguration;
386+
// Enable generating full dump when error occurs.
387+
gcPerfSimBasicConfiguration.Environment.environment_variables["DOTNET_DbgEnableMiniDump"] = "1";
388+
gcPerfSimBasicConfiguration.Environment.environment_variables["DOTNET_DbgMiniDumpType"] = "4";
389+
390+
return gcPerfSimBasicConfiguration;
387391
}
388392
}
389393
}

0 commit comments

Comments
 (0)