Description:
Add more timers.
Added Stopwatch for both misc UI and debug info.
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
@@ -62,6 +62,8 | |||
|
62 | 62 | TimeSpan gridDrawTime = TimeSpan.Zero; |
|
63 | 63 | TimeSpan treeDrawTime = TimeSpan.Zero; |
|
64 | 64 | TimeSpan rendererDrawTime = TimeSpan.Zero; |
|
65 | TimeSpan miscUIDrawTime = TimeSpan.Zero; | |
|
66 | TimeSpan debugDrawTime = TimeSpan.Zero; | |
|
65 | 67 | TimeSpan updateTime = TimeSpan.Zero; |
|
66 | 68 | TimeSpan worldUpdateTime = TimeSpan.Zero; |
|
67 | 69 | TimeSpan simulationUpdateTime = TimeSpan.Zero; |
@@ -679,6 +681,7 | |||
|
679 | 681 | |
|
680 | 682 | string fps = string.Format("fps: {0}", frameRate); |
|
681 | 683 | bool has_tree = false; |
|
684 | Stopwatch stopWatch2 = new Stopwatch(); | |
|
682 | 685 | |
|
683 | 686 | Stopwatch stopWatch = new Stopwatch(); |
|
684 | 687 | stopWatch.Start(); |
@@ -697,7 +700,6 | |||
|
697 | 700 | |
|
698 | 701 | |
|
699 | 702 | #region draw_tiles |
|
700 | Stopwatch stopWatch2 = new Stopwatch(); | |
|
701 | 703 | stopWatch2.Start(); |
|
702 | 704 | //reset |
|
703 | 705 | this.tilesDrawn = 0; |
@@ -862,6 +864,8 | |||
|
862 | 864 | this.rendererDrawTime = stopWatch2.Elapsed; |
|
863 | 865 | |
|
864 | 866 | #region draw_header |
|
867 | stopWatch2 = new Stopwatch(); | |
|
868 | stopWatch2.Start(); | |
|
865 | 869 | batch.Begin(SpriteSortMode.BackToFront, |
|
866 | 870 | BlendState.AlphaBlend, |
|
867 | 871 | null, |
@@ -921,8 +925,17 | |||
|
921 | 925 | batch.DrawString(monoFont, status_left, new Vector2(1, top), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); |
|
922 | 926 | batch.DrawString(monoFont, header_left, new Vector2(1, 1), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.5f); |
|
923 | 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 | 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 | 939 | #region budget |
|
927 | 940 | |
|
928 | 941 | if (this.showBudget) |
@@ -932,11 +945,6 | |||
|
932 | 945 | |
|
933 | 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 | 948 | if (quit) { |
|
941 | 949 | System.Environment.Exit(0); |
|
942 | 950 | } |
@@ -983,6 +991,8 | |||
|
983 | 991 | |
|
984 | 992 | |
|
985 | 993 | #region debug_window |
|
994 | stopWatch2 = new Stopwatch(); | |
|
995 | stopWatch2.Start(); | |
|
986 | 996 | //Calcs for debug window: |
|
987 | 997 | past_draw.Enqueue(this.drawTime); |
|
988 | 998 | if ((this.frameCounter % 15) == 0) |
@@ -1021,6 +1031,8 | |||
|
1021 | 1031 | gridDrawTime = this.gridDrawTime, |
|
1022 | 1032 | tileDrawTime = this.tileDrawTime, |
|
1023 | 1033 | rendererDrawTime = this.rendererDrawTime, |
|
1034 | miscUIDrawTime = this.miscUIDrawTime, | |
|
1035 | debugDrawTime = this.debugDrawTime, | |
|
1024 | 1036 | updateTime = this.updateTime, |
|
1025 | 1037 | worldUpdateTime = this.worldUpdateTime, |
|
1026 | 1038 | simulationUpdateTime = this.simulationUpdateTime, |
@@ -1082,6 +1094,9 | |||
|
1082 | 1094 | |
|
1083 | 1095 | _imGuiRenderer.AfterLayout(); |
|
1084 | 1096 | |
|
1097 | stopWatch2.Stop(); | |
|
1098 | this.debugDrawTime = stopWatch2.Elapsed; | |
|
1099 | ||
|
1085 | 1100 | #endregion debug_window |
|
1086 | 1101 | |
|
1087 | 1102 | stopWatch.Stop(); |
@@ -20,6 +20,8 | |||
|
20 | 20 | public TimeSpan gridDrawTime; |
|
21 | 21 | public TimeSpan tileDrawTime; |
|
22 | 22 | public TimeSpan rendererDrawTime; |
|
23 | public TimeSpan miscUIDrawTime; | |
|
24 | public TimeSpan debugDrawTime; | |
|
23 | 25 | public Vector2 cameraPosition; |
|
24 | 26 | public int treeCount; |
|
25 | 27 | public Vector2 mouseGrid; |
@@ -227,11 +229,13 | |||
|
227 | 229 | |
|
228 | 230 | ImGui.Text(string.Format("fps: {0:F3}", debugInfo.fps)); |
|
229 | 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 |
|
|
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 | 233 | debugInfo.treeDrawTime.TotalMilliseconds.ToString(), |
|
232 | 234 | debugInfo.gridDrawTime.TotalMilliseconds.ToString(), |
|
233 | 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 | 239 | ImGui.Text(string.Format("Update Time: {0:F3}", debugInfo.updateTime.TotalMilliseconds.ToString())); |
|
236 | 240 | ImGui.Text(string.Format("\tWorld: {0:F3}; Simulation: {1:F3}", |
|
237 | 241 | debugInfo.worldUpdateTime.TotalMilliseconds.ToString(), |
You need to be logged in to leave comments.
Login now