Description:
Add timers for Simulation and various engines Starting to add additional timers for different stages of the process of updating in order to get more insight into what is slowing it down. The update takes 9ms, which is much longer than it used to. Engine-specific timers are coming later.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r588:3b7b6298ad9c -

@@ -62,6 +62,8
62 62 TimeSpan gridDrawTime = TimeSpan.Zero;
63 63 TimeSpan treeDrawTime = TimeSpan.Zero;
64 64 TimeSpan updateTime = TimeSpan.Zero;
65 TimeSpan worldUpdateTime = TimeSpan.Zero;
66 TimeSpan simulationUpdateTime = TimeSpan.Zero;
65 67
66 68 Queue<float> past_fps = new Queue<float>(100);
67 69 Queue<TimeSpan> past_draw = new Queue<TimeSpan>(100);
@@ -479,6 +481,7
479 481 protected override void Update(GameTime gameTime)
480 482 {
481 483 Stopwatch stopWatch = new Stopwatch();
484 Stopwatch stopWatch2 = new Stopwatch();
482 485 stopWatch.Start();
483 486
484 487 #if DEBUG
@@ -504,8 +507,16
504 507 #endregion misc_keys
505 508 #endregion input
506 509
510 stopWatch2.Start();
507 511 World.Update(gameTime.ElapsedGameTime.TotalSeconds);
512 stopWatch2.Stop();
513 this.worldUpdateTime = stopWatch2.Elapsed;
514
515 stopWatch2 = new Stopwatch();
516 stopWatch2.Start();
508 517 this.simulation.update(gameTime.ElapsedGameTime);
518 stopWatch2.Stop();
519 this.simulationUpdateTime = stopWatch2.Elapsed;
509 520
510 521 if (this.showBudget)
511 522 {
@@ -976,6 +987,8
976 987 gridDrawTime = this.gridDrawTime,
977 988 tileDrawTime = this.tileDrawTime,
978 989 updateTime = this.updateTime,
990 worldUpdateTime = this.worldUpdateTime,
991 simulationUpdateTime = this.simulationUpdateTime,
979 992 treeCount = this.simulation.map.tree_count,
980 993 mouseGrid = this.mouseGrid,
981 994 hasTree = has_tree,
@@ -26,6 +26,9
26 26 public Boolean hasTree;
27 27 public int tilesDrawn;
28 28 public TimeSpan updateTime;
29 public TimeSpan worldUpdateTime;
30 public TimeSpan simulationUpdateTime;
31
29 32 }
30 33
31 34 public class DebugWindow
@@ -232,6 +235,9
232 235 debugInfo.gridDrawTime.TotalMilliseconds.ToString(),
233 236 debugInfo.tileDrawTime.TotalMilliseconds.ToString()));
234 237 ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString()));
238 ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}",
239 debugInfo.worldUpdateTime.TotalMilliseconds.ToString(),
240 debugInfo.simulationUpdateTime.TotalMilliseconds.ToString()));
235 241 ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn));
236 242
237 243
You need to be logged in to leave comments. Login now