Removed all the internal performance monitoring in favor of an external tool.

This commit is contained in:
larsbrubaker 2014-03-02 15:28:47 -08:00
parent 5f364b4db7
commit e3c70b0268
4 changed files with 34 additions and 64 deletions

View file

@ -1,4 +1,33 @@
using System;
/*
Copyright (c) 2014, Lars Brubaker
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@ -79,10 +108,8 @@ namespace MatterHackers.MatterControl
VAnchor = VAnchor.ParentCenter | Agg.UI.VAnchor.FitToChildren;
}
static NamedExecutionTimer drawTimer = new NamedExecutionTimer("TextImgBtnFctry");
public override void OnDraw(Graphics2D graphics2D)
{
drawTimer.Start();
if (borderColor.Alpha0To255 > 0)
{
RectangleDouble boarderRectangle = LocalBounds;
@ -102,7 +129,6 @@ namespace MatterHackers.MatterControl
}
base.OnDraw(graphics2D);
drawTimer.Stop();
}
}

View file

@ -69,7 +69,6 @@ namespace MatterHackers.MatterControl
bool firstDraw = true;
bool ShowMemoryUsed = false;
bool DoCGCollectEveryDraw = false;
bool ShowDrawTimingWindow = false;
public MatterControlApplication(double width, double height)
: base(width, height)
@ -99,15 +98,13 @@ namespace MatterHackers.MatterControl
ShowMemoryUsed = true;
DoCGCollectEveryDraw = true;
break;
case "SHOW_DRAW_TIMING":
ShowDrawTimingWindow = true;
break;
}
}
//WriteTestGCodeFile();
#if !DEBUG
if (File.Exists("RunUnitTests.txt"))
#endif
{
GuiHalWidget.SetClipboardFunctions(System.Windows.Forms.Clipboard.GetText, System.Windows.Forms.Clipboard.SetText, System.Windows.Forms.Clipboard.ContainsText);
@ -274,24 +271,15 @@ namespace MatterHackers.MatterControl
Stopwatch totalDrawTime = new Stopwatch();
int drawCount = 0;
PerformanceFeedbackWindow timingWindow = null;
static NamedExecutionTimer drawTimer = new NamedExecutionTimer("MatterContorl Draw");
public override void OnDraw(Graphics2D graphics2D)
{
if (ShowDrawTimingWindow)
{
ExecutionTimer.Instance.Reset();
totalDrawTime.Restart();
}
drawTimer.Start();
totalDrawTime.Restart();
base.OnDraw(graphics2D);
drawTimer.Stop();
totalDrawTime.Stop();
if (ShowMemoryUsed)
{
totalDrawTime.Stop();
long memory = GC.GetTotalMemory(false);
this.Title = string.Format("Allocated = {0:n0} : {1}ms, d{2} Size = {3}x{4}", memory, totalDrawTime.ElapsedMilliseconds, drawCount++, this.Width, this.Height);
if (DoCGCollectEveryDraw)
@ -300,19 +288,6 @@ namespace MatterHackers.MatterControl
}
}
if (ShowDrawTimingWindow)
{
if (timingWindow == null)
{
timingWindow = new PerformanceFeedbackWindow();
}
if (totalDrawTime.Elapsed.TotalSeconds > .05)
{
timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
}
}
if (firstDraw)
{
Parent.MinimumSize = new Vector2(590, 540);

View file

@ -99,34 +99,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
PerformanceFeedbackWindow timingWindow = null;
Stopwatch totalDrawTime = new Stopwatch();
static NamedExecutionTimer partPreviewDraw = new NamedExecutionTimer("PartPreview Draw");
public override void OnDraw(Graphics2D graphics2D)
{
ExecutionTimer.Instance.Reset();
totalDrawTime.Restart();
partPreviewDraw.Start();
base.OnDraw(graphics2D);
partPreviewDraw.Stop();
totalDrawTime.Stop();
#if true //DEBUG
#if false
if (timingWindow == null)
{
string staticDataPath = ApplicationDataStorage.Instance.ApplicationStaticDataPath;
string fontPath = Path.Combine(staticDataPath, "Fonts", "LiberationMono.svg");
TypeFace boldTypeFace = TypeFace.LoadSVG(fontPath);
timingWindow = new PerformanceFeedbackWindow(new StyledTypeFace(boldTypeFace, 12));
//}
//{
timingWindow.ShowResults(totalDrawTime.Elapsed.TotalSeconds);
}
#endif
#endif
}
event EventHandler unregisterEvents;
private void AddHandlers()
{

View file

@ -221,12 +221,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
static NamedExecutionTimer drawTimer = new NamedExecutionTimer("View3DTrans");
public override void OnDraw(Graphics2D graphics2D)
{
drawTimer.Start();
base.OnDraw(graphics2D);
drawTimer.Stop();
}
public override void OnMouseMove(MouseEventArgs mouseEvent)