Skip to content

Commit 79ecfac

Browse files
authored
Upload the trace file and related info in case of failure (for easier debugging/fixing later) (#2763) (#2849)
1 parent 8acb969 commit 79ecfac

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/tools/ScenarioMeasurement/Startup/Startup.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,23 @@ static void checkArg(string arg, string name)
332332
commandLine = commandLine + " " + appArgs;
333333
}
334334

335-
var counters = parser.Parse(traceFilePath, Path.GetFileNameWithoutExtension(appExe), pids, commandLine);
336-
337-
CreateTestReport(scenarioName, counters, reportJsonPath, logger);
335+
var processName = Path.GetFileNameWithoutExtension(appExe);
336+
try
337+
{
338+
var counters = parser.Parse(traceFilePath, processName, pids, commandLine);
339+
CreateTestReport(scenarioName, counters, reportJsonPath, logger);
340+
}
341+
catch
342+
{
343+
logger.Log($"{nameof(parser)} = {parser.GetType().FullName}");
344+
logger.Log($"{nameof(processName)} = {processName}");
345+
logger.Log($"{nameof(pids)} = {string.Join(", ", pids)}");
346+
logger.Log($"{nameof(commandLine)} = {commandLine}");
347+
var destFileName = Path.Join(Environment.GetEnvironmentVariable("HELIX_WORKITEM_UPLOAD_ROOT"), Path.GetFileName(traceFilePath));
348+
File.Copy(traceFilePath, destFileName, true);
349+
logger.Log($"Copied {traceFilePath} to {destFileName}");
350+
throw;
351+
}
338352
}
339353

340354
// Skip unimplemented Linux profiling

0 commit comments

Comments
 (0)