diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs index 66ebbc6cd..918173958 100644 --- a/MatterControlApplication.cs +++ b/MatterControlApplication.cs @@ -536,7 +536,7 @@ namespace MatterHackers.MatterControl { totalDrawTime.Restart(); GuiWidget.DrawCount = 0; - //using (new PerformanceTimer("Draw Timer", "Total")) + using (new PerformanceTimer("Draw Timer", "Total")) { base.OnDraw(graphics2D); } diff --git a/Submodules/agg-sharp b/Submodules/agg-sharp index 7b354408b..68c12f96e 160000 --- a/Submodules/agg-sharp +++ b/Submodules/agg-sharp @@ -1 +1 @@ -Subproject commit 7b354408b73c777f0bb9e139676f924702317701 +Subproject commit 68c12f96e037a8c7a52383fb86fcef20ad362400 diff --git a/Utilities/PerformanceTimer/IPerformanceResults.cs b/Utilities/PerformanceTimer/IPerformanceResults.cs index 34a05975c..361184f52 100644 --- a/Utilities/PerformanceTimer/IPerformanceResults.cs +++ b/Utilities/PerformanceTimer/IPerformanceResults.cs @@ -43,6 +43,6 @@ namespace MatterHackers.MatterControl { internal interface IPerformanceResults { - void SetTime(string name, double elapsedSeconds); + void SetTime(string name, double elapsedSeconds, int recursionCount); } } diff --git a/Utilities/PerformanceTimer/PerformanceResultsMCOverlay.cs b/Utilities/PerformanceTimer/PerformanceResultsMCOverlay.cs index c344a0277..25ec84711 100644 --- a/Utilities/PerformanceTimer/PerformanceResultsMCOverlay.cs +++ b/Utilities/PerformanceTimer/PerformanceResultsMCOverlay.cs @@ -65,6 +65,8 @@ namespace MatterHackers.MatterControl private event EventHandler unregisterEvents; + FlowLayoutWidget bottomToTop = new FlowLayoutWidget(FlowDirection.BottomToTop); + internal PerformanceResultsMCOverlay(string name) : base(FlowDirection.TopToBottom) { @@ -89,6 +91,8 @@ namespace MatterHackers.MatterControl titleWidget.Printer.DrawFromHintedCache = true; AddChild(titleWidget); + AddChild(bottomToTop); + pannels.AddChild(this); BackgroundColor = new RGBA_Bytes(RGBA_Bytes.White, 180); @@ -108,7 +112,7 @@ namespace MatterHackers.MatterControl base.OnDraw(graphics2D); } - public void SetTime(string name, double elapsedSeconds) + public void SetTime(string name, double elapsedSeconds, int recursionCount) { if (!timers.ContainsKey(name)) { @@ -116,14 +120,28 @@ namespace MatterHackers.MatterControl { AutoExpandBoundsToText = true, TextColor = new RGBA_Bytes(120, 20, 20), + HAnchor = HAnchor.ParentLeft, }; newTimeWidget.Printer.DrawFromHintedCache = true; timers.Add(name, newTimeWidget); - - AddChild(newTimeWidget); + + bottomToTop.AddChild(newTimeWidget); } - timers[name].Text = "{0:0.00} ms - {1}".FormatWith(elapsedSeconds * 1000, name); + timers[name].Margin = new BorderDouble(recursionCount * 5, 0, 0, 0); + string outputText = "{0:0.00} ms - {1}".FormatWith(elapsedSeconds * 1000, name); + if(recursionCount > 0) + { + if(recursionCount == 1) + { + outputText = "|_" + outputText; + } + else + { + outputText = new string(' ', recursionCount-1) + "|_" + outputText; + } + } + timers[name].Text = outputText; } } } diff --git a/Utilities/PerformanceTimer/PerformanceResultsSystemWindow.cs b/Utilities/PerformanceTimer/PerformanceResultsSystemWindow.cs index 8f21b1e34..b10930797 100644 --- a/Utilities/PerformanceTimer/PerformanceResultsSystemWindow.cs +++ b/Utilities/PerformanceTimer/PerformanceResultsSystemWindow.cs @@ -62,7 +62,7 @@ namespace MatterHackers.MatterControl ShowAsSystemWindow(); } - public void SetTime(string name, double elapsedSeconds) + public void SetTime(string name, double elapsedSeconds, int recursionCount) { if (!timers.ContainsKey(name)) { diff --git a/Utilities/PerformanceTimer/PerformanceTimer.cs b/Utilities/PerformanceTimer/PerformanceTimer.cs index 416475f0b..0c0307b00 100644 --- a/Utilities/PerformanceTimer/PerformanceTimer.cs +++ b/Utilities/PerformanceTimer/PerformanceTimer.cs @@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl { public class PerformanceTimer : IDisposable { - static int runningCount = 0; + static int recursionCount = 0; static Dictionary resultsWindows = new Dictionary(); private IPerformanceResults timingWindowToReportTo; @@ -61,14 +61,14 @@ namespace MatterHackers.MatterControl this.timingWindowToReportTo = resultsWindows[windowName]; this.name = name; timer = Stopwatch.StartNew(); - runningCount++; + recursionCount++; } public void Dispose() { timer.Stop(); - runningCount--; - timingWindowToReportTo.SetTime(name, timer.Elapsed.TotalSeconds); + recursionCount--; + timingWindowToReportTo.SetTime(name, timer.Elapsed.TotalSeconds, recursionCount); } } }