add 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()
|
||||||
|
|||||||
@@ -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