mirror of
https://github.com/SourMesen/Mesen.git
synced 2025-04-02 10:52:48 -04:00
Debugger: Profiler now uses the same refresh/auto-refresh settings as the other tools
This commit is contained in:
parent
dbe7686724
commit
3be231efb7
3 changed files with 56 additions and 34 deletions
19
GUI.NET/Debugger/Controls/ctrlProfiler.Designer.cs
generated
19
GUI.NET/Debugger/Controls/ctrlProfiler.Designer.cs
generated
|
@ -28,7 +28,6 @@
|
|||
private void InitializeComponent()
|
||||
{
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.btnRefresh = new System.Windows.Forms.Button();
|
||||
this.btnReset = new System.Windows.Forms.Button();
|
||||
this.lstFunctions = new Mesen.GUI.Controls.DoubleBufferedListView();
|
||||
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
|
@ -45,12 +44,11 @@
|
|||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
|
||||
this.tableLayoutPanel1.Controls.Add(this.btnRefresh, 0, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.btnReset, 1, 2);
|
||||
this.tableLayoutPanel1.Controls.Add(this.lstFunctions, 0, 1);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 3;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
|
||||
|
@ -59,16 +57,6 @@
|
|||
this.tableLayoutPanel1.Size = new System.Drawing.Size(514, 307);
|
||||
this.tableLayoutPanel1.TabIndex = 3;
|
||||
//
|
||||
// btnRefresh
|
||||
//
|
||||
this.btnRefresh.Location = new System.Drawing.Point(3, 281);
|
||||
this.btnRefresh.Name = "btnRefresh";
|
||||
this.btnRefresh.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnRefresh.TabIndex = 8;
|
||||
this.btnRefresh.Text = "Refresh";
|
||||
this.btnRefresh.UseVisualStyleBackColor = true;
|
||||
this.btnRefresh.Click += new System.EventHandler(this.btnRefresh_Click);
|
||||
//
|
||||
// btnReset
|
||||
//
|
||||
this.btnReset.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
|
@ -95,7 +83,7 @@
|
|||
this.lstFunctions.GridLines = true;
|
||||
this.lstFunctions.HideSelection = false;
|
||||
this.lstFunctions.Location = new System.Drawing.Point(0, 0);
|
||||
this.lstFunctions.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
||||
this.lstFunctions.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.lstFunctions.Name = "lstFunctions";
|
||||
this.lstFunctions.Size = new System.Drawing.Size(514, 278);
|
||||
this.lstFunctions.TabIndex = 7;
|
||||
|
@ -134,7 +122,7 @@
|
|||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.tableLayoutPanel1);
|
||||
this.Margin = new System.Windows.Forms.Padding(0, 0, 0, 0);
|
||||
this.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.Name = "ctrlProfiler";
|
||||
this.Size = new System.Drawing.Size(514, 307);
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
|
@ -150,7 +138,6 @@
|
|||
private System.Windows.Forms.ColumnHeader columnHeader4;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader2;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader3;
|
||||
private System.Windows.Forms.Button btnRefresh;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader5;
|
||||
private System.Windows.Forms.ColumnHeader columnHeader6;
|
||||
}
|
||||
|
|
|
@ -66,7 +66,11 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
|
||||
lstFunctions.BeginUpdate();
|
||||
lstFunctions.ListViewItemSorter = null;
|
||||
lstFunctions.Items.Clear();
|
||||
|
||||
int? topItemIndex = lstFunctions.TopItem?.Index;
|
||||
int selectedIndex = lstFunctions.SelectedIndices.Count > 0 ? lstFunctions.SelectedIndices[0] : -1;
|
||||
|
||||
int itemNumber = 0;
|
||||
for(UInt32 i = 0; i < _exclusiveTime.Length; i++) {
|
||||
if(_exclusiveTime[i] > 0) {
|
||||
string functionName;
|
||||
|
@ -83,29 +87,56 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
}
|
||||
}
|
||||
|
||||
ListViewItem item = lstFunctions.Items.Add(functionName);
|
||||
item.Tag = i;
|
||||
ListViewItem item;
|
||||
if(itemNumber >= lstFunctions.Items.Count) {
|
||||
item = lstFunctions.Items.Add("");
|
||||
item.SubItems.Add("");
|
||||
item.SubItems.Add("");
|
||||
item.SubItems.Add("");
|
||||
item.SubItems.Add("");
|
||||
item.SubItems.Add("");
|
||||
} else {
|
||||
item = lstFunctions.Items[itemNumber];
|
||||
}
|
||||
|
||||
item.SubItems.Add(_callCount[i].ToString());
|
||||
item.Text = functionName;
|
||||
|
||||
item.Tag = i;
|
||||
item.Selected = false;
|
||||
item.Focused = false;
|
||||
|
||||
item.SubItems[1].Text = _callCount[i].ToString();
|
||||
item.SubItems[1].Tag = _callCount[i];
|
||||
|
||||
item.SubItems.Add(_inclusiveTime[i].ToString());
|
||||
item.SubItems[2].Text = _inclusiveTime[i].ToString();
|
||||
item.SubItems[2].Tag = _inclusiveTime[i];
|
||||
|
||||
double ratio = ((double)_inclusiveTime[i] / exclusiveTotal)*100;
|
||||
item.SubItems.Add(ratio.ToString("0.00"));
|
||||
double ratio = ((double)_inclusiveTime[i] / exclusiveTotal) *100;
|
||||
item.SubItems[3].Text = ratio.ToString("0.00");
|
||||
item.SubItems[3].Tag = (Int64)(ratio*100);
|
||||
|
||||
item.SubItems.Add(_exclusiveTime[i].ToString());
|
||||
item.SubItems[4].Text = _exclusiveTime[i].ToString();
|
||||
item.SubItems[4].Tag = _exclusiveTime[i];
|
||||
|
||||
ratio = ((double)_exclusiveTime[i] / exclusiveTotal)*100;
|
||||
item.SubItems.Add(ratio.ToString("0.00"));
|
||||
item.SubItems[5].Text = ratio.ToString("0.00");
|
||||
item.SubItems[5].Tag = (Int64)(ratio*100);
|
||||
|
||||
itemNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
lstFunctions.ListViewItemSorter = new ListComparer(_sortColumn, _sortOrder);
|
||||
lstFunctions.EndUpdate();
|
||||
|
||||
if(topItemIndex.HasValue) {
|
||||
lstFunctions.TopItem = lstFunctions.Items[topItemIndex.Value];
|
||||
}
|
||||
|
||||
if(selectedIndex >= 0) {
|
||||
lstFunctions.Items[selectedIndex].Selected = true;
|
||||
lstFunctions.Items[selectedIndex].Focused = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void btnReset_Click(object sender, EventArgs e)
|
||||
|
@ -113,14 +144,10 @@ namespace Mesen.GUI.Debugger.Controls
|
|||
lock(_resetLock) {
|
||||
InteropEmu.DebugResetProfiler();
|
||||
}
|
||||
lstFunctions.Items.Clear();
|
||||
RefreshData();
|
||||
}
|
||||
|
||||
private void btnRefresh_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.RefreshData();
|
||||
}
|
||||
|
||||
|
||||
private void lstFunctions_ColumnClick(object sender, ColumnClickEventArgs e)
|
||||
{
|
||||
if(_sortColumn == e.Column) {
|
||||
|
|
|
@ -23,10 +23,13 @@ namespace Mesen.GUI.Debugger
|
|||
private DebugWorkspace _previousWorkspace;
|
||||
private bool _updating = false;
|
||||
private DateTime _lastUpdate = DateTime.MinValue;
|
||||
private TabPage _selectedTab;
|
||||
|
||||
public frmMemoryViewer()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this._selectedTab = this.tabMain.SelectedTab;
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
|
@ -171,6 +174,10 @@ namespace Mesen.GUI.Debugger
|
|||
case RefreshSpeed.High: refreshDelay = 16; break;
|
||||
}
|
||||
|
||||
if(_selectedTab == tpgProfiler) {
|
||||
refreshDelay *= 10;
|
||||
}
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
if(!_updating && ConfigManager.Config.DebugInfo.RamAutoRefresh && (now - _lastUpdate).Milliseconds >= refreshDelay) {
|
||||
_lastUpdate = now;
|
||||
|
@ -248,6 +255,8 @@ namespace Mesen.GUI.Debugger
|
|||
} else if(this.tabMain.SelectedTab == this.tpgMemoryViewer) {
|
||||
this.UpdateByteColorProvider();
|
||||
this.ctrlHexViewer.SetData(InteropEmu.DebugGetMemoryState(this._memoryType));
|
||||
} else if(this.tabMain.SelectedTab == this.tpgProfiler) {
|
||||
this.ctrlProfiler.RefreshData();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -376,9 +385,8 @@ namespace Mesen.GUI.Debugger
|
|||
|
||||
private void tabMain_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
if(this.tabMain.SelectedTab == this.tpgProfiler) {
|
||||
this.ctrlProfiler.RefreshData();
|
||||
}
|
||||
_selectedTab = this.tabMain.SelectedTab;
|
||||
this.RefreshData();
|
||||
}
|
||||
|
||||
private void ctrlHexViewer_RequiredWidthChanged(object sender, EventArgs e)
|
||||
|
|
Loading…
Add table
Reference in a new issue