private String CreateMetricsFile() { var path = String.Format("{0}metrics_{1}{2}.csv", m_workingDir, (m_testName == null?"":m_testName + "_"), DateTime.Now.ToString("yyyyMMdd-HHmmss")); path = Path.GetFullPath(path); Directory.CreateDirectory(m_workingDir); using (File.CreateText(path)) { if (!File.Exists(path)) { throw new InvalidOperationException(String.Format("Couldn't create the metrics file path: {0}", path)); } } using (var writer = File.AppendText(path)) { writer.WriteLine(MetricsFileUtil.Header()); } return(path); }
public void OnMetric(TestId testId, PerformanceMetric metric) { if (m_collectingMetrics) { m_writer.WriteLine(MetricsFileUtil.ToLine(testId, m_startTime, metric)); } }
private PerformanceMetric ReadLineToMetrics(string metricLineEntry) { if (metricLineEntry.StartsWith("#")) { return(null); } PerformanceMetric metric; if (MetricsFileUtil.TryRead(metricLineEntry, out metric)) { return(metric); } return(null); }