Example #1
0
        private void AddMetricSeries(PlotModel model, string title, IBenchmarkCounter icounter)
        {
            BenchmarkCounterIntervals counter = icounter as BenchmarkCounterIntervals;

            if (counter == null)
            {
                return;
            }

            IEnumerable <float> data = counter.GetData();

            if (data == null)
            {
                return;
            }

            LineSeries series = new LineSeries();

            series.Title           = title;
            series.MarkerType      = MarkerType.None;
            series.Smooth          = false;
            series.StrokeThickness = 1;

            IEnumerable <float> fps = data.Select(t => 1000.0f / t);

            int index = 0;

            foreach (float value in fps)
            {
                series.Points.Add(new DataPoint(++index, value));
            }

            model.Series.Add(series);
        }
Example #2
0
        private void AddMetricSummary(RichTextBox rtbReport, string title, BenchmarkCounterIntervals counter)
        {
            Dictionary <string, float> metrics = counter.GetMetrics();

            if (metrics == null)
            {
                return;
            }

            StringBuilder b = new StringBuilder();

            b.AppendLine(title);

            b.AppendLine(string.Format("- 99th percentile: {0:0.000} FPS", 1000 / metrics["Percentile99"]));
            b.AppendLine(string.Format("- 95th percentile: {0:0.000} FPS", 1000 / metrics["Percentile95"]));
            b.AppendLine(string.Format("- Median: {0:0.000} FPS", 1000 / metrics["Median"]));
            b.AppendLine(string.Format("- Average: {0:0.000} FPS", 1000 / metrics["Average"]));
            b.AppendLine(string.Format("- Standard deviation: {0:0.000} ms", metrics["StandardDeviation"]));
            b.AppendLine("");
            b.AppendLine("");
            rtbReport.AppendText(b.ToString());
        }