perf stuff is a bit nicer; render time shown
This commit is contained in:
@@ -85,8 +85,7 @@ namespace OpenRa.Game
|
|||||||
PlaySound("intro.aud", false);
|
PlaySound("intro.aud", false);
|
||||||
|
|
||||||
skipMakeAnims = false;
|
skipMakeAnims = false;
|
||||||
|
PerfHistory.items["render"].hasNormalTick = false;
|
||||||
sw = new Stopwatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadMapBuildings( IniFile mapfile )
|
static void LoadMapBuildings( IniFile mapfile )
|
||||||
@@ -148,8 +147,6 @@ namespace OpenRa.Game
|
|||||||
public static double TickTime = 0.0;
|
public static double TickTime = 0.0;
|
||||||
public static double OreTime = 0.0;
|
public static double OreTime = 0.0;
|
||||||
|
|
||||||
public static Stopwatch sw;
|
|
||||||
|
|
||||||
public static void Tick()
|
public static void Tick()
|
||||||
{
|
{
|
||||||
int t = Environment.TickCount;
|
int t = Environment.TickCount;
|
||||||
@@ -158,7 +155,6 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
using (new PerfSample("tick_time"))
|
using (new PerfSample("tick_time"))
|
||||||
{
|
{
|
||||||
sw.Reset();
|
|
||||||
lastTime += timestep;
|
lastTime += timestep;
|
||||||
|
|
||||||
if (orderManager.Tick())
|
if (orderManager.Tick())
|
||||||
@@ -178,18 +174,20 @@ namespace OpenRa.Game
|
|||||||
foreach (var player in players.Values)
|
foreach (var player in players.Values)
|
||||||
player.Tick();
|
player.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
TickTime = sw.ElapsedTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PerfHistory.Tick();
|
PerfHistory.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Reset();
|
using (new PerfSample("render"))
|
||||||
|
{
|
||||||
|
|
||||||
++RenderFrame;
|
++RenderFrame;
|
||||||
viewport.cursor = controller.ChooseCursor();
|
viewport.cursor = controller.ChooseCursor();
|
||||||
viewport.DrawRegions();
|
viewport.DrawRegions();
|
||||||
RenderTime = sw.ElapsedTime();
|
}
|
||||||
|
|
||||||
|
PerfHistory.items["render"].Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsCellBuildable(int2 a, UnitMovementType umt)
|
public static bool IsCellBuildable(int2 a, UnitMovementType umt)
|
||||||
|
|||||||
@@ -99,13 +99,12 @@ namespace OpenRa.Game.Graphics
|
|||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
|
|
||||||
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\nOre ({4:F1} ms)\n$ {5}\nPower {7}\nTiles Expanded {6:F0}",
|
renderer.DrawText(string.Format("RenderFrame {0} ({2:F1} ms)\nTick {1} ({3:F1} ms)\n$ {4}\nPower {5}",
|
||||||
Game.RenderFrame, Game.orderManager.FrameNumber,
|
Game.RenderFrame,
|
||||||
Game.RenderTime * 1000,
|
Game.orderManager.FrameNumber,
|
||||||
Game.TickTime * 1000,
|
PerfHistory.items["render"].LastValue,
|
||||||
Game.OreTime * 1000,
|
PerfHistory.items["tick_time"].LastValue,
|
||||||
Game.LocalPlayer.Cash,
|
Game.LocalPlayer.Cash,
|
||||||
PerfHistory.items[ "nodes_expanded" ].LastValue,
|
|
||||||
Game.LocalPlayer.GetTotalPower()
|
Game.LocalPlayer.GetTotalPower()
|
||||||
), new int2(5, 5), Color.White);
|
), new int2(5, 5), Color.White);
|
||||||
|
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace OpenRa.Game.Support
|
|||||||
public static void Tick()
|
public static void Tick()
|
||||||
{
|
{
|
||||||
foreach (var item in items.Values)
|
foreach (var item in items.Values)
|
||||||
|
if (item.hasNormalTick)
|
||||||
item.Tick();
|
item.Tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +66,7 @@ namespace OpenRa.Game.Support
|
|||||||
public double[] samples = new double[100];
|
public double[] samples = new double[100];
|
||||||
public double val = 0.0;
|
public double val = 0.0;
|
||||||
int head = 1, tail = 0;
|
int head = 1, tail = 0;
|
||||||
|
public bool hasNormalTick = true;
|
||||||
|
|
||||||
public PerfItem(string name, Color c)
|
public PerfItem(string name, Color c)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user