Skip to content

Commit 3927ce7

Browse files
authored
Fix #2611 - Add Iteration mode and stage filtering to ScottPlotExporter (#2612)
* Fix #2611 - Add Iteration mode and stage filtering * Fix #2611 - Also choose time scale based on results
1 parent 29a0ebb commit 3927ce7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/BenchmarkDotNet.Exporters.Plotting/ScottPlotExporter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.IO;
44
using System.Linq;
5+
using BenchmarkDotNet.Engines;
56
using BenchmarkDotNet.Loggers;
67
using BenchmarkDotNet.Properties;
78
using BenchmarkDotNet.Reports;
@@ -83,7 +84,8 @@ public IEnumerable<string> ExportToFiles(Summary summary, ILogger consoleLogger)
8384
var version = BenchmarkDotNetInfo.Instance.BrandTitle;
8485
var annotations = GetAnnotations(version);
8586

86-
var (timeUnit, timeScale) = GetTimeUnit(summary.Reports.SelectMany(m => m.AllMeasurements));
87+
var (timeUnit, timeScale) = GetTimeUnit(summary.Reports
88+
.SelectMany(m => m.AllMeasurements.Where(m => m.Is(IterationMode.Workload, IterationStage.Result))));
8789

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

0 commit comments

Comments
 (0)