Description:
Add more timers. Added Stopwatch for both misc UI and debug info.
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r666:6a1d64c93e49 -

@@ -62,6 +62,8
62 TimeSpan gridDrawTime = TimeSpan.Zero;
62 TimeSpan gridDrawTime = TimeSpan.Zero;
63 TimeSpan treeDrawTime = TimeSpan.Zero;
63 TimeSpan treeDrawTime = TimeSpan.Zero;
64 TimeSpan rendererDrawTime = TimeSpan.Zero;
64 TimeSpan rendererDrawTime = TimeSpan.Zero;
65 TimeSpan miscUIDrawTime = TimeSpan.Zero;
66 TimeSpan debugDrawTime = TimeSpan.Zero;
65 TimeSpan updateTime = TimeSpan.Zero;
67 TimeSpan updateTime = TimeSpan.Zero;
66 TimeSpan worldUpdateTime = TimeSpan.Zero;
68 TimeSpan worldUpdateTime = TimeSpan.Zero;
67 TimeSpan simulationUpdateTime = TimeSpan.Zero;
69 TimeSpan simulationUpdateTime = TimeSpan.Zero;
@@ -679,6 +681,7
679
681
680 string fps = string.Format("fps: {0}", frameRate);
682 string fps = string.Format("fps: {0}", frameRate);
681 bool has_tree = false;
683 bool has_tree = false;
684 Stopwatch stopWatch2 = new Stopwatch();
682
685
683 Stopwatch stopWatch = new Stopwatch();
686 Stopwatch stopWatch = new Stopwatch();
684 stopWatch.Start();
687 stopWatch.Start();
@@ -697,7 +700,6
697
700
698
701
699 #region draw_tiles
702 #region draw_tiles
700 Stopwatch stopWatch2 = new Stopwatch();
701 stopWatch2.Start();
703 stopWatch2.Start();
702 //reset
704 //reset
703 this.tilesDrawn = 0;
705 this.tilesDrawn = 0;
@@ -862,6 +864,8
862 this.rendererDrawTime = stopWatch2.Elapsed;
864 this.rendererDrawTime = stopWatch2.Elapsed;
863
865
864 #region draw_header
866 #region draw_header
867 stopWatch2 = new Stopwatch();
868 stopWatch2.Start();
865 batch.Begin(SpriteSortMode.BackToFront,
869 batch.Begin(SpriteSortMode.BackToFront,
866 BlendState.AlphaBlend,
870 BlendState.AlphaBlend,
867 null,
871 null,
@@ -921,8 +925,17
921 batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
925 batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
922 batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
926 batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
923 batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
927 batch.DrawString(monoFont, header_middle, new Vector2(middle_start, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f);
928
924 #endregion draw_header
929 #endregion draw_header
925
930
931
932 batch.End();
933
934 #region window
935 Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
936 stopWatch2.Stop();
937 this.miscUIDrawTime = stopWatch2.Elapsed;
938
926 #region budget
939 #region budget
927
940
928 if (this.showBudget)
941 if (this.showBudget)
@@ -932,11 +945,6
932
945
933 #endregion budget
946 #endregion budget
934
947
935 batch.End();
936
937 #region window
938 Menu.Render(debugWindow.monoFont, FNAGame.width, this.imGuiWindowBridgeEngine, ref quit, ref this.simulation.paused, ref this.simulation.currentRate, ref this.showBudget, header_left);
939
940 if (quit) {
948 if (quit) {
941 System.Environment.Exit(0);
949 System.Environment.Exit(0);
942 }
950 }
@@ -983,6 +991,8
983
991
984
992
985 #region debug_window
993 #region debug_window
994 stopWatch2 = new Stopwatch();
995 stopWatch2.Start();
986 //Calcs for debug window:
996 //Calcs for debug window:
987 past_draw.Enqueue(this.drawTime);
997 past_draw.Enqueue(this.drawTime);
988 if ((this.frameCounter % 15) == 0)
998 if ((this.frameCounter % 15) == 0)
@@ -1021,6 +1031,8
1021 gridDrawTime = this.gridDrawTime,
1031 gridDrawTime = this.gridDrawTime,
1022 tileDrawTime = this.tileDrawTime,
1032 tileDrawTime = this.tileDrawTime,
1023 rendererDrawTime = this.rendererDrawTime,
1033 rendererDrawTime = this.rendererDrawTime,
1034 miscUIDrawTime = this.miscUIDrawTime,
1035 debugDrawTime = this.debugDrawTime,
1024 updateTime = this.updateTime,
1036 updateTime = this.updateTime,
1025 worldUpdateTime = this.worldUpdateTime,
1037 worldUpdateTime = this.worldUpdateTime,
1026 simulationUpdateTime = this.simulationUpdateTime,
1038 simulationUpdateTime = this.simulationUpdateTime,
@@ -1082,6 +1094,9
1082
1094
1083 _imGuiRenderer.AfterLayout();
1095 _imGuiRenderer.AfterLayout();
1084
1096
1097 stopWatch2.Stop();
1098 this.debugDrawTime = stopWatch2.Elapsed;
1099
1085 #endregion debug_window
1100 #endregion debug_window
1086
1101
1087 stopWatch.Stop();
1102 stopWatch.Stop();
@@ -20,6 +20,8
20 public TimeSpan gridDrawTime;
20 public TimeSpan gridDrawTime;
21 public TimeSpan tileDrawTime;
21 public TimeSpan tileDrawTime;
22 public TimeSpan rendererDrawTime;
22 public TimeSpan rendererDrawTime;
23 public TimeSpan miscUIDrawTime;
24 public TimeSpan debugDrawTime;
23 public Vector2 cameraPosition;
25 public Vector2 cameraPosition;
24 public int treeCount;
26 public int treeCount;
25 public Vector2 mouseGrid;
27 public Vector2 mouseGrid;
@@ -227,11 +229,13
227
229
228 ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps));
230 ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps));
229 ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString()));
231 ImGui.Text(string.Format("Draw Time: {0:F3}", debugInfo.drawTime.TotalMilliseconds.ToString()));
230 ImGui.Text(string.Format("\tTree: {0,7:F3}; Grid: {1,7:F3}; Tile: {2,7:F3}\n\t Renderer: {3,7:F3}",
232 ImGui.Text(string.Format("\tTree: {0,7:F3}; Grid: {1,7:F3}; Tile: {2,7:F3}\n\tRenderer: {3,7:F3}; Misc UI: {4,7:F3}; Debug: {5,7:F3}",
231 debugInfo.treeDrawTime.TotalMilliseconds.ToString(),
233 debugInfo.treeDrawTime.TotalMilliseconds.ToString(),
232 debugInfo.gridDrawTime.TotalMilliseconds.ToString(),
234 debugInfo.gridDrawTime.TotalMilliseconds.ToString(),
233 debugInfo.tileDrawTime.TotalMilliseconds.ToString(),
235 debugInfo.tileDrawTime.TotalMilliseconds.ToString(),
234 debugInfo.rendererDrawTime.TotalMilliseconds.ToString()));
236 debugInfo.rendererDrawTime.TotalMilliseconds.ToString(),
237 debugInfo.miscUIDrawTime.TotalMilliseconds.ToString(),
238 debugInfo.debugDrawTime.TotalMilliseconds.ToString()));
235 ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString()));
239 ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString()));
236 ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}",
240 ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}",
237 debugInfo.worldUpdateTime.TotalMilliseconds.ToString(),
241 debugInfo.worldUpdateTime.TotalMilliseconds.ToString(),
You need to be logged in to leave comments. Login now