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:
parent
015470203b
commit
86a41649ec
12 changed files with 150 additions and 76 deletions
57
IDE/src/ui/DiagnosticsPanel.bf
Normal file
57
IDE/src/ui/DiagnosticsPanel.bf
Normal 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");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -143,6 +143,10 @@ namespace IDE.ui
|
|||
{
|
||||
panel = gApp.mMemoryPanel;
|
||||
}
|
||||
else if (type == "DiagnosticsPanel")
|
||||
{
|
||||
panel = gApp.mDiagnosticsPanel;
|
||||
}
|
||||
else if (type == "AutoCompletePanel")
|
||||
{
|
||||
panel = gApp.mAutoCompletePanel;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue