Skip to content

Commit

Permalink
Fix #2611 - Add Iteration mode and stage filtering to ScottPlotExport…
Browse files Browse the repository at this point in the history
…er (#2612)

* Fix #2611 - Add Iteration mode and stage filtering

* Fix #2611 - Also choose time scale based on results
  • Loading branch information
FlatlinerDOA committed Aug 25, 2024
1 parent 29a0ebb commit 3927ce7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/BenchmarkDotNet.Exporters.Plotting/ScottPlotExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Loggers;
using BenchmarkDotNet.Properties;
using BenchmarkDotNet.Reports;
Expand Down Expand Up @@ -83,7 +84,8 @@ public IEnumerable<string> ExportToFiles(Summary summary, ILogger consoleLogger)
var version = BenchmarkDotNetInfo.Instance.BrandTitle;
var annotations = GetAnnotations(version);

var (timeUnit, timeScale) = GetTimeUnit(summary.Reports.SelectMany(m => m.AllMeasurements));
var (timeUnit, timeScale) = GetTimeUnit(summary.Reports
.SelectMany(m => m.AllMeasurements.Where(m => m.Is(IterationMode.Workload, IterationStage.Result))));

foreach (var benchmark in summary.Reports.GroupBy(r => r.BenchmarkCase.Descriptor.Type.Name))
{
Expand All @@ -93,6 +95,7 @@ public IEnumerable<string> ExportToFiles(Summary summary, ILogger consoleLogger)
var timeStats = from report in benchmark
let jobId = report.BenchmarkCase.DisplayInfo.Replace(report.BenchmarkCase.Descriptor.DisplayInfo + ": ", string.Empty)
from measurement in report.AllMeasurements
where measurement.Is(IterationMode.Workload, IterationStage.Result)
let measurementValue = measurement.Nanoseconds / measurement.Operations
group measurementValue / timeScale by (Target: report.BenchmarkCase.Descriptor.WorkloadMethodDisplayInfo, JobId: jobId) into g
select (g.Key.Target, g.Key.JobId, Mean: g.Average(), StdError: StandardError(g.ToList()));
Expand Down

0 comments on commit 3927ce7

Please sign in to comment.