示例#1
0
        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);
        }
示例#2
0
 public void OnMetric(TestId testId, PerformanceMetric metric)
 {
     if (m_collectingMetrics)
     {
         m_writer.WriteLine(MetricsFileUtil.ToLine(testId, m_startTime, metric));
     }
 }
示例#3
0
        private PerformanceMetric ReadLineToMetrics(string metricLineEntry)
        {
            if (metricLineEntry.StartsWith("#"))
            {
                return(null);
            }
            PerformanceMetric metric;

            if (MetricsFileUtil.TryRead(metricLineEntry, out metric))
            {
                return(metric);
            }

            return(null);
        }