Skip to content

Commit

Permalink
Benchmark changes
Browse files Browse the repository at this point in the history
Various adjustments to produce results in the format required for the
PowerBI perflab platform.
  • Loading branch information
roji committed May 11, 2019
1 parent dc72342 commit 5a99be1
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 42 deletions.
12 changes: 0 additions & 12 deletions benchmark/EFCore.SqlServer.Benchmarks/Program.cs

This file was deleted.

12 changes: 0 additions & 12 deletions benchmark/EFCore.SqlServer.EF6.Benchmarks/Program.cs

This file was deleted.

12 changes: 0 additions & 12 deletions benchmark/EFCore.Sqlite.Benchmarks/Program.cs

This file was deleted.

6 changes: 0 additions & 6 deletions benchmark/Shared.EFCore/Properties/SharedAssemblyInfo.cs

This file was deleted.

28 changes: 28 additions & 0 deletions benchmark/Shared/ParamsSummaryColumn.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;

namespace BenchmarkDotNet.Attributes
{
// Used to generate a single BDN output column combining all the parameters.
// Required by the perflab's PowerBI setup.
public class ParamsSummaryColumn : IColumn
{
public string Id => nameof(ParamsSummaryColumn);
public string ColumnName { get; } = "Params";
public bool IsDefault(Summary summary, BenchmarkCase benchmark) => false;
public string GetValue(Summary summary, BenchmarkCase benchmark) => benchmark.Parameters.DisplayInfo;
public bool IsAvailable(Summary summary) => true;
public bool AlwaysShow => true;
public ColumnCategory Category => ColumnCategory.Params;
public int PriorityInCategory => 0;
public override string ToString() => ColumnName;
public bool IsNumeric => false;
public UnitType UnitType => UnitType.Dimensionless;
public string GetValue(Summary summary, BenchmarkCase benchmark, ISummaryStyle style) => GetValue(summary, benchmark);
public string Legend => $"Summary of all parameter values";
}
}
56 changes: 56 additions & 0 deletions benchmark/Shared/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.Linq;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Columns;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Diagnosers;
using BenchmarkDotNet.Exporters;
using BenchmarkDotNet.Exporters.Csv;
using BenchmarkDotNet.Horology;
using BenchmarkDotNet.Reports;
using BenchmarkDotNet.Running;

namespace Microsoft.EntityFrameworkCore.Benchmarks
{
public static class Program
{
static void Main(string[] args)
{
var config = DefaultConfig.Instance
.With(DefaultConfig.Instance.GetDiagnosers().Concat(new[] { MemoryDiagnoser.Default }).ToArray());

var index = Array.FindIndex(args, s => s == "--perflab");
if (index >= 0)
{
var argList = args.ToList();
argList.RemoveAt(index);
args = argList.ToArray();

config = config
.With(new[]
{
StatisticColumn.OperationsPerSecond,
new ParamsSummaryColumn()
})
.With(new[]
{
MarkdownExporter.GitHub,
new CsvExporter(
CsvSeparator.Comma,
new SummaryStyle
{
PrintUnitsInHeader = true,
PrintUnitsInContent = false,
TimeUnit = TimeUnit.Microsecond,
SizeUnit = SizeUnit.KB
})
});
}

BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, config);
}
}
}

0 comments on commit 5a99be1

Please sign in to comment.