profiling thinsg
This commit is contained in:
BIN
Assets/Audio/player_jumplandv2.wav
Normal file
BIN
Assets/Audio/player_jumplandv2.wav
Normal file
Binary file not shown.
BIN
Content/Audio/player_jumplandv2.flax
Normal file
BIN
Content/Audio/player_jumplandv2.flax
Normal file
Binary file not shown.
@@ -117,7 +117,7 @@
|
|||||||
"Transform": {
|
"Transform": {
|
||||||
"Translation": {
|
"Translation": {
|
||||||
"X": 0.0,
|
"X": 0.0,
|
||||||
"Y": 730.0,
|
"Y": 248.0,
|
||||||
"Z": 0.0
|
"Z": 0.0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -170,9 +170,9 @@
|
|||||||
},
|
},
|
||||||
"Offsets": {
|
"Offsets": {
|
||||||
"Left": 0.0,
|
"Left": 0.0,
|
||||||
"Right": 143.0,
|
"Right": 30948.0,
|
||||||
"Top": -80.0,
|
"Top": -562.0,
|
||||||
"Bottom": 112.0
|
"Bottom": 576.0
|
||||||
},
|
},
|
||||||
"Scale": {
|
"Scale": {
|
||||||
"X": 1.0,
|
"X": 1.0,
|
||||||
|
|||||||
@@ -206,10 +206,10 @@ namespace Cabrito
|
|||||||
if (!font)
|
if (!font)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Profiler.BeginEvent("ConsoleContetTextBoxDraw");
|
|
||||||
Stopwatch sw = Stopwatch.StartNew();
|
Stopwatch sw = Stopwatch.StartNew();
|
||||||
|
|
||||||
// Background
|
// Background
|
||||||
|
Profiler.BeginEvent("ConsoleContentTextBoxDraw_Background");
|
||||||
Color backColor = BackgroundColor;
|
Color backColor = BackgroundColor;
|
||||||
if (IsMouseOver)
|
if (IsMouseOver)
|
||||||
backColor = BackgroundSelectedColor;
|
backColor = BackgroundSelectedColor;
|
||||||
@@ -219,17 +219,23 @@ namespace Cabrito
|
|||||||
Color borderColor = IsFocused ? BorderSelectedColor : BorderColor;
|
Color borderColor = IsFocused ? BorderSelectedColor : BorderColor;
|
||||||
if (borderColor.A > 0.0f)
|
if (borderColor.A > 0.0f)
|
||||||
Render2D.DrawRectangle(rect, borderColor);
|
Render2D.DrawRectangle(rect, borderColor);
|
||||||
|
Profiler.EndEvent();
|
||||||
|
|
||||||
|
Profiler.BeginEvent("ConsoleContentTextBoxDraw_FetchLines");
|
||||||
var lines = Console.Lines;
|
var lines = Console.Lines;
|
||||||
|
Profiler.EndEvent();
|
||||||
if (lines.Count > 0)
|
if (lines.Count > 0)
|
||||||
{
|
{
|
||||||
|
Profiler.BeginEvent("ConsoleContentTextBoxDraw_Lines");
|
||||||
|
|
||||||
// Apply view offset and clip mask
|
// Apply view offset and clip mask
|
||||||
var textClipRectangle = new Rectangle(1, 1, Width - 2, Height - 2);
|
var textClipRectangle = new Rectangle(1, 1, Width - 2, Height - 2);
|
||||||
Render2D.PushClip(textClipRectangle);
|
Render2D.PushClip(textClipRectangle);
|
||||||
|
|
||||||
|
Profiler.BeginEvent("ConsoleContentTextBoxDraw_CalcVisLines");
|
||||||
// Make sure lengthy lines are split
|
// Make sure lengthy lines are split
|
||||||
CalculateVisibleLines(lines, out int startLine, out int lastLine, out LineInfo[] wrappedLines);
|
CalculateVisibleLines(lines, out int startLine, out int lastLine, out LineInfo[] wrappedLines);
|
||||||
|
Profiler.EndEvent();
|
||||||
|
|
||||||
float lineHeight = font.Height / Platform.DpiScale;
|
float lineHeight = font.Height / Platform.DpiScale;
|
||||||
float accumHeight = wrappedLines.Length * lineHeight;
|
float accumHeight = wrappedLines.Length * lineHeight;
|
||||||
@@ -252,6 +258,7 @@ namespace Cabrito
|
|||||||
// render selection
|
// render selection
|
||||||
if (selectionActive)
|
if (selectionActive)
|
||||||
{
|
{
|
||||||
|
Profiler.BeginEvent("ConsoleContentTextBoxDraw_Selection");
|
||||||
//float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f);
|
//float alpha = Mathf.Min(1.0f, Mathf.Cos(_animateTime * BackgroundSelectedFlashSpeed) * 0.5f + 1.3f);
|
||||||
//alpha = alpha * alpha;
|
//alpha = alpha * alpha;
|
||||||
Color selectionColor = SelectionColor; // * alpha;
|
Color selectionColor = SelectionColor; // * alpha;
|
||||||
@@ -327,10 +334,13 @@ namespace Cabrito
|
|||||||
|
|
||||||
layout.Bounds.Y += lineHeight;
|
layout.Bounds.Y += lineHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Profiler.EndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
// render lines
|
// render lines
|
||||||
{
|
{
|
||||||
|
Profiler.BeginEvent("ConsoleContentTextBoxDraw_Lines_Render");
|
||||||
TextLayoutOptions layout = _layout;
|
TextLayoutOptions layout = _layout;
|
||||||
layout.Bounds = rect;
|
layout.Bounds = rect;
|
||||||
layout.Bounds.Y -= accumHeight - Height;
|
layout.Bounds.Y -= accumHeight - Height;
|
||||||
@@ -341,6 +351,7 @@ namespace Cabrito
|
|||||||
Render2D.DrawText(font, line, TextColor, ref layout);
|
Render2D.DrawText(font, line, TextColor, ref layout);
|
||||||
layout.Bounds.Y += lineHeight;
|
layout.Bounds.Y += lineHeight;
|
||||||
}
|
}
|
||||||
|
Profiler.EndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (CaretPosition > -1)
|
/*if (CaretPosition > -1)
|
||||||
@@ -355,12 +366,13 @@ namespace Cabrito
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
Render2D.PopClip();
|
Render2D.PopClip();
|
||||||
|
|
||||||
|
Profiler.EndEvent();
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
accumDrawTime += sw.Elapsed.TotalSeconds;
|
accumDrawTime += sw.Elapsed.TotalSeconds;
|
||||||
accumDrawTimes++;
|
accumDrawTimes++;
|
||||||
Profiler.EndEvent();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using FlaxEditor.Content.Settings;
|
using FlaxEditor.Content.Settings;
|
||||||
using FlaxEngine;
|
using FlaxEngine;
|
||||||
using FlaxEngine.GUI;
|
using FlaxEngine.GUI;
|
||||||
|
|
||||||
|
|
||||||
namespace Cabrito
|
namespace Cabrito
|
||||||
{
|
{
|
||||||
[ExecuteInEditMode]
|
[ExecuteInEditMode]
|
||||||
@@ -88,6 +91,35 @@ namespace Cabrito
|
|||||||
sb.Append("\nCon: " + conTime.ToString() + "ms");
|
sb.Append("\nCon: " + conTime.ToString() + "ms");
|
||||||
sb.Append("\n" + currentRenderer);
|
sb.Append("\n" + currentRenderer);
|
||||||
sb.Append("\nGC memory: " + (GC.GetTotalMemory(false) / 1000000.0f).ToString() + "MB");
|
sb.Append("\nGC memory: " + (GC.GetTotalMemory(false) / 1000000.0f).ToString() + "MB");
|
||||||
|
//sb.Append("\nUpdate profiler: " + updateProfTime.ToString() + "ms");
|
||||||
|
|
||||||
|
#if BUILD_DEVELOPMENT
|
||||||
|
var nameOffset = Marshal.OffsetOf(typeof(ProfilerCPU.Event), "Name0");
|
||||||
|
foreach (var eventsCpu in FlaxEngine.ProfilingTools.EventsCPU)
|
||||||
|
{
|
||||||
|
sb.Append("\nName: " + eventsCpu.Name + " ");
|
||||||
|
foreach (var eventt in eventsCpu.Events)
|
||||||
|
{
|
||||||
|
#if FLAX_EDITOR
|
||||||
|
string eventName = eventt.Name;
|
||||||
|
#else
|
||||||
|
string eventName;
|
||||||
|
unsafe
|
||||||
|
{
|
||||||
|
var ptr1 = &eventt;
|
||||||
|
char* ptr2 = (char*)(new IntPtr((byte*)ptr1 + nameOffset.ToInt64()));
|
||||||
|
//fixed (char* name = &eventt)
|
||||||
|
{
|
||||||
|
eventName = new string(ptr2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sb.Append(eventName + " " + (eventt.End-eventt.Start) + "ms, ");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
((Label) control.Control).Text = sb.ToString();
|
((Label) control.Control).Text = sb.ToString();
|
||||||
/*if (!Platform.HasFocus)
|
/*if (!Platform.HasFocus)
|
||||||
|
|||||||
Reference in New Issue
Block a user