Add warning when using memory profiler without enabled on startup
This commit is contained in:
@@ -29,6 +29,7 @@ namespace FlaxEditor.Windows.Profiler
|
||||
private List<Row> _tableRowsCache;
|
||||
private string[] _groupNames;
|
||||
private int[] _groupOrder;
|
||||
private Label _warningText;
|
||||
|
||||
public Memory()
|
||||
: base("Memory")
|
||||
@@ -65,6 +66,18 @@ namespace FlaxEditor.Windows.Profiler
|
||||
};
|
||||
_managedAllocationsChart.SelectedSampleChanged += OnSelectedSampleChanged;
|
||||
|
||||
// Warning text
|
||||
if (!ProfilerMemory.Enabled)
|
||||
{
|
||||
_warningText = new Label
|
||||
{
|
||||
Text = "Detailed memory profiling is disabled. Run with command line: -mem",
|
||||
TextColor = Color.Red,
|
||||
Visible = false,
|
||||
Parent = layout,
|
||||
};
|
||||
}
|
||||
|
||||
// Table
|
||||
var style = Style.Current;
|
||||
var headerColor = style.LightBackground;
|
||||
@@ -204,6 +217,8 @@ namespace FlaxEditor.Windows.Profiler
|
||||
{
|
||||
if (_frames.Count == 0)
|
||||
return;
|
||||
if (_warningText != null)
|
||||
_warningText.Visible = true;
|
||||
var frame = _frames.Get(selectedFrame);
|
||||
var totalUage = frame.Usage.Values0[(int)ProfilerMemory.Groups.TotalTracked];
|
||||
var totalPeek = frame.Peek.Values0[(int)ProfilerMemory.Groups.TotalTracked];
|
||||
|
||||
@@ -186,6 +186,10 @@ namespace
|
||||
output.AppendLine();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Warn that data might be missing due to inactive profiler
|
||||
if (!ProfilerMemory::Enabled)
|
||||
output.AppendLine(TEXT("Detailed memory profiling is disabled. Run with command line: -mem"));
|
||||
}
|
||||
|
||||
FORCE_INLINE void AddGroupMemory(ProfilerMemory::Groups group, int64 add)
|
||||
|
||||
@@ -215,7 +215,7 @@ public:
|
||||
/// <summary>
|
||||
/// The profiling tools usage flag. Can be used to disable profiler. Run engine with '-mem' command line to activate it from start.
|
||||
/// </summary>
|
||||
static bool Enabled;
|
||||
API_FIELD(ReadOnly) static bool Enabled;
|
||||
|
||||
static void OnMemoryAlloc(void* ptr, uint64 size);
|
||||
static void OnMemoryFree(void* ptr);
|
||||
|
||||
Reference in New Issue
Block a user