private void appendTimesCSVLine(string fileName, TimesResultRow timesResultRow) { using (StreamWriter timesStreamWriter = new StreamWriter(fileName, append: true)) { timesStreamWriter.WriteLine(timesResultRow.Tool + "," + timesResultRow.Workload + "," + timesResultRow.Description + "," + timesResultRow.Model + "," + timesResultRow.Run + "," + timesResultRow.Phase + "," + timesResultRow.Iteration + "," + timesResultRow.Time); } }
private void routeSensorInjectTest() { string timesFileName = resultDirectory + "times-" + ToolName + "-RouteSensorInjectTest-railway-inject-" + modelSize + "-.csv"; //createMatchesCSVHeader(resultDirectory + "matches-" + ToolName + "RouteSensorInjectTest-railway-batch-" + modelSize + "-.csv"); createTimesCSVHeader(timesFileName); TimesResultRow timesResultRow = new TimesResultRow { Tool = ToolName, Workload = "RouteSensorInjectTest", Description = "", Model = "railway-inject-" + modelSize, Run = "1", Phase = "Read", Iteration = null, Time = 0 }; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); readInject(); stopWatch.Stop(); timesResultRow.Time = stopWatch.ElapsedTicks / (Stopwatch.Frequency / (1000L * 1000L));; appendTimesCSVLine(timesFileName, timesResultRow); timesResultRow.Phase = "Check"; timesResultRow.Time = 0; stopWatch.Restart(); checkRouteSensor(); stopWatch.Stop(); timesResultRow.Time = stopWatch.ElapsedTicks / (Stopwatch.Frequency / (1000L * 1000L)); appendTimesCSVLine(timesFileName, timesResultRow); timesResultRow.Phase = "Transformation"; timesResultRow.Time = 0; timesResultRow.Iteration = 1; stopWatch.Restart(); routeSensorInject(); stopWatch.Stop(); timesResultRow.Time = stopWatch.ElapsedTicks / (Stopwatch.Frequency / (1000L * 1000L));; appendTimesCSVLine(timesFileName, timesResultRow); timesResultRow.Phase = "Recheck"; timesResultRow.Time = 0; stopWatch.Restart(); checkRouteSensor(); stopWatch.Stop(); timesResultRow.Time = stopWatch.ElapsedTicks / (Stopwatch.Frequency / (1000L * 1000L));; appendTimesCSVLine(timesFileName, timesResultRow); }