mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-04 15:26:00 +02:00
Added Diagnostics panel
This commit is contained in:
parent
015470203b
commit
86a41649ec
12 changed files with 150 additions and 76 deletions
|
@ -254,6 +254,7 @@ namespace IDE
|
|||
Add("Show Call Stack", new => gApp.ShowCallstack);
|
||||
Add("Show Class View", new => gApp.ShowClassViewPanel);
|
||||
Add("Show Current", new => gApp.Cmd_ShowCurrent);
|
||||
Add("Show Diagnostics", new => gApp.ShowDiagnostics);
|
||||
Add("Show Disassembly", new => gApp.[Friend]ShowDisassemblyAtStack);
|
||||
Add("Show Errors", new => gApp.[Friend]ShowErrors);
|
||||
Add("Show Error Next", new => gApp.ShowErrorNext);
|
||||
|
|
|
@ -273,6 +273,9 @@ namespace IDE.Debugger
|
|||
[CallingConvention(.Stdcall),CLink]
|
||||
static extern char8* CallStack_GetStackMethodOwner(int32 stackFrameIdx, out int32 language);
|
||||
|
||||
[CallingConvention(.Stdcall),CLink]
|
||||
static extern char8* Debugger_GetProcessInfo();
|
||||
|
||||
[CallingConvention(.Stdcall),CLink]
|
||||
static extern char8* Debugger_GetThreadInfo();
|
||||
|
||||
|
@ -967,6 +970,14 @@ namespace IDE.Debugger
|
|||
outStr.Append(str);
|
||||
}
|
||||
|
||||
public void GetProcessInfo(String outProcessInfo)
|
||||
{
|
||||
if (!mIsRunning)
|
||||
return;
|
||||
char8* strPtr = Debugger_GetProcessInfo();
|
||||
outProcessInfo.Append(strPtr);
|
||||
}
|
||||
|
||||
public void GetThreadInfo(String outThreadInfo)
|
||||
{
|
||||
if (!mIsRunning)
|
||||
|
|
|
@ -199,6 +199,7 @@ namespace IDE
|
|||
public CallStackPanel mCallStackPanel;
|
||||
public ErrorsPanel mErrorsPanel;
|
||||
public BreakpointPanel mBreakpointPanel;
|
||||
public DiagnosticsPanel mDiagnosticsPanel;
|
||||
public ModulePanel mModulePanel;
|
||||
public ThreadPanel mThreadPanel;
|
||||
public ProfilePanel mProfilePanel;
|
||||
|
@ -659,6 +660,7 @@ namespace IDE
|
|||
RemoveAndDelete!(mMemoryPanel);
|
||||
RemoveAndDelete!(mCallStackPanel);
|
||||
RemoveAndDelete!(mBreakpointPanel);
|
||||
RemoveAndDelete!(mDiagnosticsPanel);
|
||||
RemoveAndDelete!(mModulePanel);
|
||||
RemoveAndDelete!(mThreadPanel);
|
||||
RemoveAndDelete!(mProfilePanel);
|
||||
|
@ -746,6 +748,7 @@ namespace IDE
|
|||
dlg(mCallStackPanel);
|
||||
dlg(mErrorsPanel);
|
||||
dlg(mBreakpointPanel);
|
||||
dlg(mDiagnosticsPanel);
|
||||
dlg(mModulePanel);
|
||||
dlg(mThreadPanel);
|
||||
dlg(mProfilePanel);
|
||||
|
@ -4515,6 +4518,12 @@ namespace IDE
|
|||
ShowPanel(mBreakpointPanel, "Breakpoints");
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ShowDiagnostics()
|
||||
{
|
||||
ShowPanel(mDiagnosticsPanel, "Diagnostics");
|
||||
}
|
||||
|
||||
[IDECommand]
|
||||
public void ShowModules()
|
||||
{
|
||||
|
@ -5093,16 +5102,17 @@ namespace IDE
|
|||
//////////
|
||||
|
||||
subMenu = root.AddMenuItem("&View");
|
||||
AddMenuItem(subMenu, "A&utoComplete", "Show Autocomplete Panel");
|
||||
AddMenuItem(subMenu, "AutoComplet&e", "Show Autocomplete Panel");
|
||||
AddMenuItem(subMenu, "&Auto Watches", "Show Auto Watches");
|
||||
AddMenuItem(subMenu, "&Breakpoints", "Show Breakpoints");
|
||||
AddMenuItem(subMenu, "&Call Stack", "Show Call Stack");
|
||||
AddMenuItem(subMenu, "C&lass View", "Show Class View");
|
||||
AddMenuItem(subMenu, "&Diagnostics", "Show Diagnostics");
|
||||
AddMenuItem(subMenu, "E&rrors", "Show Errors");
|
||||
AddMenuItem(subMenu, "&Find Results", "Show Find Results");
|
||||
AddMenuItem(subMenu, "&Immediate Window", "Show Immediate");
|
||||
AddMenuItem(subMenu, "&Memory", "Show Memory");
|
||||
AddMenuItem(subMenu, "Mo&dules", "Show Modules");
|
||||
AddMenuItem(subMenu, "Mod&ules", "Show Modules");
|
||||
AddMenuItem(subMenu, "&Output", "Show Output");
|
||||
AddMenuItem(subMenu, "&Profiler", "Show Profiler");
|
||||
AddMenuItem(subMenu, "&Threads", "Show Threads");
|
||||
|
@ -10771,6 +10781,8 @@ namespace IDE
|
|||
mCallStackPanel.mAutoDelete = false;
|
||||
mBreakpointPanel = new BreakpointPanel();
|
||||
mBreakpointPanel.mAutoDelete = false;
|
||||
mDiagnosticsPanel = new DiagnosticsPanel();
|
||||
mDiagnosticsPanel.mAutoDelete = false;
|
||||
mErrorsPanel = new ErrorsPanel();
|
||||
mErrorsPanel.mAutoDelete = false;
|
||||
mModulePanel = new ModulePanel();
|
||||
|
|
|
@ -489,19 +489,20 @@ namespace IDE
|
|||
Add("Scope Next", "Alt+Down");
|
||||
Add("Set Next Statement", "Ctrl+Shift+F10");
|
||||
Add("Show Auto Watches", "Ctrl+Alt+A");
|
||||
Add("Show Autocomplete Panel", "Ctrl+Alt+U");
|
||||
Add("Show Autocomplete Panel", "Ctrl+Alt+E");
|
||||
Add("Show Breakpoints", "Ctrl+Alt+B");
|
||||
Add("Show Call Stack", "Ctrl+Alt+C");
|
||||
Add("Show Class View", "Ctrl+Alt+L");
|
||||
Add("Show Current", "Alt+C");
|
||||
Add("Show Errors", "Ctrl+Alt+E");
|
||||
Add("Show Errors", "Ctrl+Alt+R");
|
||||
Add("Show Diagnostics", "Ctrl+Alt+D");
|
||||
Add("Show Error Next", "Ctrl+Shift+F12");
|
||||
Add("Show File Externally", "Ctrl+Tilde");
|
||||
Add("Show Find Results", "Ctrl+Alt+F");
|
||||
Add("Show Fixit", "Ctrl+Period");
|
||||
Add("Show Immediate", "Ctrl+Alt+I");
|
||||
Add("Show Memory", "Ctrl+Alt+M");
|
||||
Add("Show Modules", "Ctrl+Alt+D");
|
||||
Add("Show Modules", "Ctrl+Alt+U");
|
||||
Add("Show Output", "Ctrl+Alt+O");
|
||||
Add("Show Profiler", "Ctrl+Alt+P");
|
||||
Add("Show QuickWatch", "Shift+Alt+W");
|
||||
|
|
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