1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-24 10:07:28 +08:00
osu-lazer/osu.Desktop.VisualTests/Benchmark.cs

46 lines
1.4 KiB
C#
Raw Normal View History

2017-02-09 18:24:53 +08:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
2017-02-17 17:59:30 +08:00
using osu.Framework.Screens.Testing;
2017-02-09 18:24:53 +08:00
using osu.Game;
namespace osu.Desktop.VisualTests
{
public class Benchmark : OsuGameBase
{
2017-03-23 12:52:38 +08:00
private const double time_per_test = 200;
2017-02-09 18:24:53 +08:00
[BackgroundDependencyLoader]
private void load()
2017-02-09 18:24:53 +08:00
{
Host.MaximumDrawHz = int.MaxValue;
Host.MaximumUpdateHz = int.MaxValue;
Host.MaximumInactiveHz = int.MaxValue;
}
protected override void LoadComplete()
{
base.LoadComplete();
TestBrowser f = new TestBrowser();
Add(f);
2017-03-23 12:52:38 +08:00
Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {time_per_test}ms each...");
2017-02-09 18:24:53 +08:00
for (int i = 1; i < f.TestCount; i++)
{
int loadableCase = i;
Scheduler.AddDelayed(delegate
{
f.LoadTest(loadableCase);
Console.WriteLine($@"{Time}: Switching to test #{loadableCase}");
2017-03-23 12:52:38 +08:00
}, loadableCase * time_per_test);
2017-02-09 18:24:53 +08:00
}
2017-03-23 12:52:38 +08:00
Scheduler.AddDelayed(Host.Exit, f.TestCount * time_per_test);
2017-02-09 18:24:53 +08:00
}
}
}