Making the output easier to read
This commit is contained in:
parent
b9fb72f305
commit
c19de2cf3f
6 changed files with 30 additions and 12 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 7b354408b73c777f0bb9e139676f924702317701
|
||||
Subproject commit 68c12f96e037a8c7a52383fb86fcef20ad362400
|
||||
|
|
@ -43,6 +43,6 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
internal interface IPerformanceResults
|
||||
{
|
||||
void SetTime(string name, double elapsedSeconds);
|
||||
void SetTime(string name, double elapsedSeconds, int recursionCount);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
public class PerformanceTimer : IDisposable
|
||||
{
|
||||
static int runningCount = 0;
|
||||
static int recursionCount = 0;
|
||||
static Dictionary<string, IPerformanceResults> resultsWindows = new Dictionary<string, IPerformanceResults>();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue