Made the average timer a shared resource
Put in the interface material extruder setting
This commit is contained in:
parent
519c857832
commit
ffe200c19f
3 changed files with 20 additions and 9 deletions
|
|
@ -280,10 +280,7 @@ namespace MatterHackers.MatterControl
|
|||
Stopwatch totalDrawTime = new Stopwatch();
|
||||
int drawCount = 0;
|
||||
|
||||
static readonly int averageCount = 64;
|
||||
int averageIndex = 0;
|
||||
int[] averageMsArray = new int[averageCount];
|
||||
int totalMsInArray = 0;
|
||||
AverageMillisecondTimer millisecondTimer = new AverageMillisecondTimer();
|
||||
|
||||
Gaming.Game.DataViewGraph msGraph = new Gaming.Game.DataViewGraph(new Vector2(20, 500), 50, 50, 0, 200);
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
|
|
@ -292,15 +289,13 @@ namespace MatterHackers.MatterControl
|
|||
GuiWidget.DrawCount = 0;
|
||||
base.OnDraw(graphics2D);
|
||||
totalDrawTime.Stop();
|
||||
totalMsInArray -= averageMsArray[averageIndex % averageCount];
|
||||
averageMsArray[averageIndex % averageCount] = (int)totalDrawTime.ElapsedMilliseconds;
|
||||
totalMsInArray += averageMsArray[averageIndex % averageCount];
|
||||
averageIndex++;
|
||||
|
||||
millisecondTimer.Update((int)totalDrawTime.ElapsedMilliseconds);
|
||||
|
||||
if (ShowMemoryUsed)
|
||||
{
|
||||
long memory = GC.GetTotalMemory(false);
|
||||
this.Title = "Allocated = {0:n0} : {1:000}ms, d{2} Size = {3}x{4}, onIdle = {5:00}:{6:00}, drawCount = {7}".FormatWith(memory, totalMsInArray/averageCount, drawCount++, this.Width, this.Height, UiThread.CountExpired, UiThread.Count, GuiWidget.DrawCount);
|
||||
this.Title = "Allocated = {0:n0} : {1:000}ms, d{2} Size = {3}x{4}, onIdle = {5:00}:{6:00}, drawCount = {7}".FormatWith(memory, millisecondTimer.GetAverage(), drawCount++, this.Width, this.Height, UiThread.CountExpired, UiThread.Count, GuiWidget.DrawCount);
|
||||
if (DoCGCollectEveryDraw)
|
||||
{
|
||||
GC.Collect();
|
||||
|
|
|
|||
|
|
@ -70,6 +70,20 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
ShowAsSystemWindow();
|
||||
}
|
||||
|
||||
#if __ANDROID__
|
||||
Stopwatch totalDrawTime = new Stopwatch();
|
||||
AverageMillisecondTimer millisecondTimer = new AverageMillisecondTimer();
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
totalDrawTime.Restart();
|
||||
base.OnDraw(graphics2D);
|
||||
totalDrawTime.Stop();
|
||||
|
||||
millisecondTimer.Update((int)totalDrawTime.ElapsedMilliseconds);
|
||||
millisecondTimer.DrawTopCenter(this, graphics2D);
|
||||
}
|
||||
#endif
|
||||
|
||||
private void AddHandlers()
|
||||
{
|
||||
ActiveTheme.Instance.ThemeChanged.RegisterEvent(ThemeChanged, ref unregisterEvents);
|
||||
|
|
|
|||
|
|
@ -236,6 +236,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
//supportExtruder=1
|
||||
new ValuePlusConstant("supportExtruder", "support_material_extruder", -1),
|
||||
|
||||
new ValuePlusConstant("supportExtruder", "support_material_interface_extruder", -1),
|
||||
|
||||
new ValuePlusConstant("raftExtruder", "raft_extruder", -1),
|
||||
|
||||
//supportLineSpacing=2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue