public IEnumerable <string> ExportToFiles(Summary summary, ILogger consoleLogger) { string fileName = GetFileName(summary); string filePath = GetArtifactFullName(summary); if (File.Exists(filePath)) { try { File.Delete(filePath); } catch (IOException) { string uniqueString = DateTime.Now.ToString("yyyyMMdd-HHmmss"); string alternativeFilePath = $"{Path.Combine(summary.ResultsDirectoryPath, fileName)}-{FileCaption}{FileNameSuffix}-{uniqueString}.{FileExtension}"; consoleLogger.WriteLineError($"Could not overwrite file {filePath}. Exporting to {alternativeFilePath}"); filePath = alternativeFilePath; } } using (var stream = StreamWriter.FromPath(filePath)) { ExportToLog(summary, new StreamLogger(stream)); } return(new[] { filePath }); }
private static string Export(Summary summary, BenchmarkCase benchmarkCase, DisassemblyResult disassemblyResult, PmcStats pmcStats) { string filePath = $"{Path.Combine(summary.ResultsDirectoryPath, benchmarkCase.Descriptor.WorkloadMethod.Name)}-{benchmarkCase.Job.Environment.Jit}-{benchmarkCase.Job.Environment.Platform}-instructionPointer.html"; if (File.Exists(filePath)) { File.Delete(filePath); } var totals = SumHardwareCountersStatsOfBenchmarkedCode(disassemblyResult, pmcStats); var perMethod = SumHardwareCountersPerMethod(disassemblyResult, pmcStats); using (var stream = StreamWriter.FromPath(filePath)) { Export(new StreamLogger(stream), benchmarkCase, totals, perMethod, pmcStats.Counters.Keys.ToArray()); } return(filePath); }