From 6eb78e73e141ae77140ad82be41f6b9e95dc3147 Mon Sep 17 00:00:00 2001 From: Lars Brubaker Date: Tue, 30 Aug 2022 17:24:56 -0700 Subject: [PATCH] adding quick timers to track draw performance --- .../PartPreviewWindow/MainViewWidget.cs | 26 ++++++++++++++++--- .../PartPreviewWindow/View3D/View3DWidget.cs | 23 +++++++++------- Submodules/MatterSlice | 2 +- Submodules/agg-sharp | 2 +- 4 files changed, 38 insertions(+), 15 deletions(-) diff --git a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs index 4b4ce61f0..67ecc1e6b 100644 --- a/MatterControlLib/PartPreviewWindow/MainViewWidget.cs +++ b/MatterControlLib/PartPreviewWindow/MainViewWidget.cs @@ -528,12 +528,32 @@ namespace MatterHackers.MatterControl.PartPreviewWindow this.RenderRunningTasks(theme, ApplicationController.Instance.Tasks); } - public override void OnDraw(Graphics2D graphics2D) + bool showQuickTiming = false; + public override void OnKeyDown(KeyEventArgs keyEvent) { - base.OnDraw(graphics2D); +#if DEBUG + if (keyEvent.KeyCode == Keys.F3) + { + showQuickTiming = !showQuickTiming; + Invalidate(); + } +#endif - // AggContext.DefaultFont.ShowDebugInfo(graphics2D); + base.OnKeyDown(keyEvent); } + + public override void OnDraw(Graphics2D graphics2D) + { + using (new QuickTimerReport("MainViewWidget.OnDraw")) + { + base.OnDraw(graphics2D); + } + + if (showQuickTiming) + { + QuickTimerReport.ReportAndRestart(graphics2D, 10, Height - 26); + } + } private void ShowUpdateAvailableAnimation() { diff --git a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs index b4220267e..702ef3d02 100644 --- a/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs +++ b/MatterControlLib/PartPreviewWindow/View3D/View3DWidget.cs @@ -1332,21 +1332,24 @@ namespace MatterHackers.MatterControl.PartPreviewWindow base.OnLoad(args); } - public override void OnDraw(Graphics2D graphics2D) + public override void OnDraw(Graphics2D graphics2D) { - var selectedItem = Scene.SelectedItem; - - if (selectedItem != null) + using (new QuickTimerReport("View3DWidget.OnDraw")) { - foreach (var volume in this.Object3DControlLayer.Object3DControls) + var selectedItem = Scene.SelectedItem; + + if (selectedItem != null) { - volume.SetPosition(selectedItem, CurrentSelectInfo); + foreach (var volume in this.Object3DControlLayer.Object3DControls) + { + volume.SetPosition(selectedItem, CurrentSelectInfo); + } } + + TrackballTumbleWidget.RecalculateProjection(); + + base.OnDraw(graphics2D); } - - TrackballTumbleWidget.RecalculateProjection(); - - base.OnDraw(graphics2D); } private void AfterDraw3DContent(object sender, DrawEventArgs e) diff --git a/Submodules/MatterSlice b/Submodules/MatterSlice index 42401e1af..ecc289e5b 160000 --- a/Submodules/MatterSlice +++ b/Submodules/MatterSlice @@ -1 +1 @@ -Subproject commit 42401e1aff4c8a327e7c28af70168499e6d36c29 +Subproject commit ecc289e5b6d9f43be6a0d1bd2d0d7ca4ada1cf33 diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 2cfd64bde..b702f6631 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 2cfd64bdeacd33f5be83556f54757b15101af146 +Subproject commit b702f66317da46a93343be83f1cda51bb29913c8