1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-30 05:15:59 +02:00

Added Diagnostics panel

This commit is contained in:
Brian Fiete 2020-07-18 06:50:28 -07:00
parent 015470203b
commit 86a41649ec
12 changed files with 150 additions and 76 deletions

View file

@ -0,0 +1,57 @@
using System;
using Beefy.utils;
using System.Diagnostics;
namespace IDE.ui
{
class DiagnosticsPanel : Panel
{
Stopwatch mSampleStopwatch = new .() ~ delete _;
int mSampleKernelTime;
int mSampleUserTime;
public this()
{
mSampleStopwatch.Start();
}
public override void Update()
{
String procInfo = scope .();
gApp.mDebugger.GetProcessInfo(procInfo);
int virtualMem = 0;
int workingMem = 0;
int kernelTime = 0;
int userTime = 0;
for (let line in procInfo.Split('\n'))
{
if (line.IsEmpty)
break;
var lineEnum = line.Split('\t');
let category = lineEnum.GetNext().Value;
let valueSV = lineEnum.GetNext().Value;
let value = int64.Parse(valueSV).Value;
switch (category)
{
case "WorkingMemory": workingMem = value;
case "VirtualMemory": virtualMem = value;
case "KernelTime": kernelTime = value;
case "UserTime": userTime = value;
}
}
}
public override void Serialize(StructuredData data)
{
base.Serialize(data);
data.Add("Type", "DiagnosticsPanel");
}
}
}

View file

@ -143,6 +143,10 @@ namespace IDE.ui
{
panel = gApp.mMemoryPanel;
}
else if (type == "DiagnosticsPanel")
{
panel = gApp.mDiagnosticsPanel;
}
else if (type == "AutoCompletePanel")
{
panel = gApp.mAutoCompletePanel;