1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-15 23:04:09 +02:00
Beef/IDE/src/ui/DiagnosticsPanel.bf

58 lines
1.1 KiB
Beef
Raw Normal View History

2020-07-18 06:50:28 -07:00
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");
}
}
}