Merge pull request #10133 from Mailaender/benchmark
Added a benchmark mode
This commit is contained in:
@@ -45,6 +45,8 @@ namespace OpenRA
|
|||||||
public static Sound Sound;
|
public static Sound Sound;
|
||||||
public static bool HasInputFocus = false;
|
public static bool HasInputFocus = false;
|
||||||
|
|
||||||
|
public static bool BenchmarkMode = false;
|
||||||
|
|
||||||
public static GlobalChat GlobalChat;
|
public static GlobalChat GlobalChat;
|
||||||
|
|
||||||
public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true)
|
public static OrderManager JoinServer(string host, int port, string password, bool recordReplay = true)
|
||||||
@@ -493,6 +495,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
Log.Write("debug", "--Tick: {0} ({1})", LocalTick, isNetTick ? "net" : "local");
|
Log.Write("debug", "--Tick: {0} ({1})", LocalTick, isNetTick ? "net" : "local");
|
||||||
|
|
||||||
|
if (BenchmarkMode)
|
||||||
|
Log.Write("cpu", "{0};{1}".F(LocalTick, PerfHistory.Items["tick_time"].LastValue));
|
||||||
|
|
||||||
if (isNetTick)
|
if (isNetTick)
|
||||||
orderManager.Tick();
|
orderManager.Tick();
|
||||||
|
|
||||||
@@ -578,6 +583,9 @@ namespace OpenRA
|
|||||||
PerfHistory.Items["batches"].Tick();
|
PerfHistory.Items["batches"].Tick();
|
||||||
PerfHistory.Items["render_widgets"].Tick();
|
PerfHistory.Items["render_widgets"].Tick();
|
||||||
PerfHistory.Items["render_flip"].Tick();
|
PerfHistory.Items["render_flip"].Tick();
|
||||||
|
|
||||||
|
if (BenchmarkMode)
|
||||||
|
Log.Write("render", "{0};{1}".F(RenderFrame, PerfHistory.Items["render"].LastValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Loop()
|
static void Loop()
|
||||||
|
|||||||
@@ -96,13 +96,25 @@ namespace OpenRA
|
|||||||
public class GraphicSettings
|
public class GraphicSettings
|
||||||
{
|
{
|
||||||
public string Renderer = "Default";
|
public string Renderer = "Default";
|
||||||
|
|
||||||
|
[Desc("This can be set to Windowed, Fullscreen or PseudoFullscreen.")]
|
||||||
public WindowMode Mode = WindowMode.PseudoFullscreen;
|
public WindowMode Mode = WindowMode.PseudoFullscreen;
|
||||||
|
|
||||||
|
[Desc("Screen resolution in fullscreen mode.")]
|
||||||
public int2 FullscreenSize = new int2(0, 0);
|
public int2 FullscreenSize = new int2(0, 0);
|
||||||
|
|
||||||
|
[Desc("Screen resolution in windowed mode.")]
|
||||||
public int2 WindowedSize = new int2(1024, 768);
|
public int2 WindowedSize = new int2(1024, 768);
|
||||||
|
|
||||||
public bool HardwareCursors = true;
|
public bool HardwareCursors = true;
|
||||||
|
|
||||||
public bool PixelDouble = false;
|
public bool PixelDouble = false;
|
||||||
public bool CursorDouble = false;
|
public bool CursorDouble = false;
|
||||||
|
|
||||||
|
[Desc("Add a frame rate limiter. It is recommended to not disable this.")]
|
||||||
public bool CapFramerate = true;
|
public bool CapFramerate = true;
|
||||||
|
|
||||||
|
[Desc("At which frames per second to cap the framerate.")]
|
||||||
public int MaxFramerate = 60;
|
public int MaxFramerate = 60;
|
||||||
|
|
||||||
public int BatchSize = 8192;
|
public int BatchSize = 8192;
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ namespace OpenRA
|
|||||||
[Desc("Automatically start playing the given replay file.")]
|
[Desc("Automatically start playing the given replay file.")]
|
||||||
public string Replay;
|
public string Replay;
|
||||||
|
|
||||||
|
[Desc("Dump performance data into cpu.csv and render.csv in the logs folder.")]
|
||||||
|
public bool Benchmark;
|
||||||
|
|
||||||
public LaunchArguments(Arguments args)
|
public LaunchArguments(Arguments args)
|
||||||
{
|
{
|
||||||
if (args == null)
|
if (args == null)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -39,6 +40,19 @@ namespace OpenRA.Mods.Common.LoadScreens
|
|||||||
Ui.ResetAll();
|
Ui.ResetAll();
|
||||||
Game.Settings.Save();
|
Game.Settings.Save();
|
||||||
|
|
||||||
|
if (Launch.Benchmark)
|
||||||
|
{
|
||||||
|
Log.AddChannel("cpu", "cpu.csv");
|
||||||
|
Log.Write("cpu", "tick;time [ms]");
|
||||||
|
|
||||||
|
Log.AddChannel("render", "render.csv");
|
||||||
|
Log.Write("render", "frame;time [ms]");
|
||||||
|
|
||||||
|
Console.WriteLine("Saving benchmark data into {0}".F(Path.Combine(Platform.SupportDir, "Logs")));
|
||||||
|
|
||||||
|
Game.BenchmarkMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Join a server directly
|
// Join a server directly
|
||||||
var connect = Launch.GetConnectAddress();
|
var connect = Launch.GetConnectAddress();
|
||||||
if (!string.IsNullOrEmpty(connect))
|
if (!string.IsNullOrEmpty(connect))
|
||||||
|
|||||||
Reference in New Issue
Block a user