Skip to content

Commit

Permalink
Added a warning when running benchmarks with debugger attached, fixed…
Browse files Browse the repository at this point in the history
… a small bug in the SerializerBenchmark
  • Loading branch information
Barsonax committed Jun 30, 2020
1 parent 5e48414 commit 6489aa2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Benchmarks/DualityBenchmarks/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using System.Diagnostics;
using System;
using System.Diagnostics;
using BenchmarkDotNet.Configs;
using BenchmarkDotNet.Running;
using Duality;
using Duality.Backend;

namespace DualityBenchmarks
{
Expand All @@ -12,6 +11,9 @@ static void Main(string[] args)
{
if (Debugger.IsAttached)
{
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"[WARNING] Running with debugger attached, using {nameof(DebugInProcessConfig)} this might affect benchmark results!");
Console.ResetColor();
BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args, new DebugInProcessConfig());
}
else {
Expand Down
3 changes: 2 additions & 1 deletion Benchmarks/DualityBenchmarks/SerializerBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using BenchmarkDotNet.Attributes;
using Duality;
using Duality.Backend;
using Duality.Launcher;

namespace DualityBenchmarks
{
Expand All @@ -27,7 +28,7 @@ public void Setup()
DualityApp.ExecutionEnvironment.Launcher,
DualityApp.ExecutionContext.Game,
new DefaultAssemblyLoader(),
null);
new LauncherArgs());

this.results = new TestObject[this.N];
this.data = new TestObject(new Random(0), 5);
Expand Down

0 comments on commit 6489aa2

Please sign in to comment.