public string GenerateStringReport(out MemoryPeakSummary memoryPeakSummary, bool spreadsheetFormat)
        {
            var stringBuilder = new StringBuilder(1000);

            //**************** MODEL EXECUTIONS REPORT - START ****************
            stringBuilder.Append($"**************** MODEL EXECUTIONS REPORT - START ****************\n");
            stringBuilder.Append($"Number of completed executions : {CompletedModelExecutionReports.Count}\n");
            if (CurrentModelExecutionReport != null)
            {
                stringBuilder.Append("Warning: last model execution was not completed. It will be logged, but information might be incomplete.\n");
            }
            stringBuilder.Append("\n");
            int i = 0;

            for (; i < CompletedModelExecutionReports.Count; ++i)
            {
                stringBuilder.Append($"--------- Execution index : {i} - START ---------\n");
                MemoryAndExecutionReportHelper.GenerateStringReport(stringBuilder, CompletedModelExecutionReports[i], spreadsheetFormat);
                stringBuilder.Append($"--------- Execution index : {i} - STOP ---------\n");
                stringBuilder.Append("\n");
            }
            if (CurrentModelExecutionReport != null)
            {
                stringBuilder.Append($"--------- Uncompleted execution - START ---------\n");
                MemoryAndExecutionReportHelper.GenerateStringReport(stringBuilder, CurrentModelExecutionReport, spreadsheetFormat);
                stringBuilder.Append($"--------- Uncompleted execution - STOP ---------\n");
                stringBuilder.Append("\n");
            }
            stringBuilder.Append($"**************** MODEL EXECUTION REPORT - STOP ****************\n");
            stringBuilder.Append("\n");
            //**************** MODEL EXECUTIONS REPORT - STOP ****************

            //**************** MEMORY SNAPSHOTS REPORTS - START ****************
            memoryPeakSummary = MemorySnapshotsReport.GenerateStringReport(stringBuilder, spreadsheetFormat);
            //**************** MEMORY SNAPSHOTS REPORTS - STOP ****************

            return(stringBuilder.ToString());
        }
        public static string ToTextFile(IModelExecutionsReporter report, bool spreadsheetFormat, out MemoryPeakSummary memoryPeakSummary, string filename = null)
        {
            string stringToSave = report.GenerateStringReport(out memoryPeakSummary, spreadsheetFormat);
            string fullPath     = Application.temporaryCachePath;

            if (filename == null)
            {
                fullPath = Path.Combine(fullPath, "ModelExecutionReport");
                fullPath = Path.ChangeExtension(fullPath, "txt");
            }
            else
            {
                fullPath = Path.Combine(fullPath, filename);
            }
            File.WriteAllText(fullPath, stringToSave);
            return(fullPath);
        }