Description:
Add timers.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r514:d097c0d7d2e6 -

@@ -49,7 +49,7
49 private SpriteFont monoFont;
49 private SpriteFont monoFont;
50 private SpriteFont largeMonoFont;
50 private SpriteFont largeMonoFont;
51
51
52 private Camera camera = new Camera(new float[] { 0.25f, 0.5f, 1.0f, 2.0f, 4.0f });
52 private Camera camera = new Camera(new float[] {0.125f, 0.25f, 0.5f, 1.0f, 2.0f, 4.0f });
53
53
54 Random random_generator = new Random();
54 Random random_generator = new Random();
55
55
@@ -57,6 +57,9
57 int frameCounter = 0;
57 int frameCounter = 0;
58 TimeSpan elapsedTime = TimeSpan.Zero;
58 TimeSpan elapsedTime = TimeSpan.Zero;
59 TimeSpan drawTime = TimeSpan.Zero;
59 TimeSpan drawTime = TimeSpan.Zero;
60 TimeSpan tileDrawTime = TimeSpan.Zero;
61 TimeSpan gridDrawTime = TimeSpan.Zero;
62 TimeSpan treeDrawTime = TimeSpan.Zero;
60 TimeSpan updateTime = TimeSpan.Zero;
63 TimeSpan updateTime = TimeSpan.Zero;
61
64
62 Queue<float> past_fps = new Queue<float>(100);
65 Queue<float> past_fps = new Queue<float>(100);
@@ -66,8 +69,8
66 private static int height = 640;
69 private static int height = 640;
67
70
68 //new tile stuff
71 //new tile stuff
69 int squaresAcross = 50;
72 int squaresAcross = 200;
70 int squaresDown = 50;
73 int squaresDown = 200;
71
74
72 Simulation simulation;
75 Simulation simulation;
73
76
@@ -550,6 +553,8
550
553
551
554
552 #region draw_tiles
555 #region draw_tiles
556 Stopwatch stopWatch2 = new Stopwatch();
557 stopWatch2.Start();
553 //reset
558 //reset
554 this.tilesDrawn = 0;
559 this.tilesDrawn = 0;
555
560
@@ -579,9 +584,13
579 }
584 }
580 }
585 }
581 }
586 }
587 stopWatch2.Stop();
588 this.tileDrawTime = stopWatch2.Elapsed;
582 #endregion draw_tiles
589 #endregion draw_tiles
583
590
584 #region draw_gridlines
591 #region draw_gridlines
592 stopWatch2 = new Stopwatch();
593 stopWatch2.Start();
585
594
586 if (this.showGrid)
595 if (this.showGrid)
587 {
596 {
@@ -615,6 +624,8
615
624
616 }
625 }
617 }
626 }
627 stopWatch2.Stop();
628 this.gridDrawTime = stopWatch2.Elapsed;
618 #endregion draw_gridlines
629 #endregion draw_gridlines
619
630
620
631
@@ -696,6 +707,8
696
707
697 #endregion draw_cursor
708 #endregion draw_cursor
698
709
710 stopWatch2 = new Stopwatch();
711 stopWatch2.Start();
699 #region draw_trees
712 #region draw_trees
700 if (this.showTrees) {
713 if (this.showTrees) {
701 for (int i = 0; i < this.simulation.map.MapHeight; i++)
714 for (int i = 0; i < this.simulation.map.MapHeight; i++)
@@ -721,6 +734,8
721 }
734 }
722 }
735 }
723 }
736 }
737 stopWatch2.Stop();
738 this.treeDrawTime = stopWatch2.Elapsed;
724 #endregion draw_trees
739 #endregion draw_trees
725
740
726 #if DEBUG
741 #if DEBUG
@@ -870,6 +885,9
870 pastFps = past_fps.ToArray(),
885 pastFps = past_fps.ToArray(),
871 cameraPosition = camera.position,
886 cameraPosition = camera.position,
872 drawTime = this.drawTime,
887 drawTime = this.drawTime,
888 treeDrawTime = this.treeDrawTime,
889 gridDrawTime = this.gridDrawTime,
890 tileDrawTime = this.tileDrawTime,
873 updateTime = this.updateTime,
891 updateTime = this.updateTime,
874 treeCount = this.simulation.map.tree_count,
892 treeCount = this.simulation.map.tree_count,
875 mouseGrid = this.mouseGrid,
893 mouseGrid = this.mouseGrid,
@@ -17,6 +17,9
17 public float fps;
17 public float fps;
18 public float[] pastFps;
18 public float[] pastFps;
19 public TimeSpan drawTime;
19 public TimeSpan drawTime;
20 public TimeSpan treeDrawTime;
21 public TimeSpan gridDrawTime;
22 public TimeSpan tileDrawTime;
20 public Vector2 cameraPosition;
23 public Vector2 cameraPosition;
21 public int treeCount;
24 public int treeCount;
22 public Vector2 mouseGrid;
25 public Vector2 mouseGrid;
@@ -224,6 +227,10
224
227
225 ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps));
228 ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps));
226 ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString()));
229 ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString()));
230 ImGui.Text(string.Format("\tTree: {0:F3}; Grid: {1:F3}; Tile: {2:F3}",
231 debugInfo.treeDrawTime.TotalMilliseconds.ToString(),
232 debugInfo.gridDrawTime.TotalMilliseconds.ToString(),
233 debugInfo.tileDrawTime.TotalMilliseconds.ToString()));
227 ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString()));
234 ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString()));
228 ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn));
235 ImGui.Text(string.Format("Tiles Drawn: {0:F}", debugInfo.tilesDrawn));
229
236
You need to be logged in to leave comments. Login now