private string GetFunctionName(ProfiledFunction func) { int hexCount = this.CpuType == CpuType.Spc ? 4 : 6; string functionName; if (func.Address.Address == -1) { functionName = "[Reset]"; } else { CodeLabel label = LabelManager.GetLabel((UInt32)func.Address.Address, func.Address.Type); switch (func.Address.Type) { case SnesMemoryType.PrgRom: functionName = "PRG: $"; break; case SnesMemoryType.Register: functionName = "REG: $"; break; case SnesMemoryType.SaveRam: functionName = "SRAM: $"; break; case SnesMemoryType.WorkRam: functionName = "WRAM: $"; break; case SnesMemoryType.SpcRam: functionName = "SPC: $"; break; case SnesMemoryType.SpcRom: functionName = "SPC ROM: $"; break; case SnesMemoryType.Sa1InternalRam: functionName = "IRAM: $"; break; case SnesMemoryType.GbPrgRom: functionName = "PRG: $"; break; case SnesMemoryType.GbWorkRam: functionName = "WRAM: $"; break; case SnesMemoryType.GbCartRam: functionName = "SRAM: $"; break; case SnesMemoryType.GbHighRam: functionName = "HRAM: $"; break; case SnesMemoryType.GbBootRom: functionName = "BOOT: $"; break; default: throw new Exception("Unsupported type"); } functionName += func.Address.Address.ToString("X" + hexCount.ToString()); if (label != null) { functionName = label.Label + " (" + functionName + ")"; } } return(functionName); }
private ListViewItem GetListItem(ProfiledFunction func) { ListViewItem item = new ListViewItem(GetFunctionName(func)); item.Selected = false; item.Focused = false; item.SubItems.Add(GetColumnContent(func, 1).ToString()); item.SubItems.Add(GetColumnContent(func, 2).ToString()); item.SubItems.Add(((double)GetColumnContent(func, 3)).ToString("0.00")); item.SubItems.Add(GetColumnContent(func, 4).ToString()); item.SubItems.Add(((double)GetColumnContent(func, 5)).ToString("0.00")); item.SubItems.Add(GetColumnContent(func, 6).ToString()); item.SubItems.Add((UInt64)GetColumnContent(func, 7) == UInt64.MaxValue ? "n/a" : GetColumnContent(func, 7).ToString()); item.SubItems.Add((UInt64)GetColumnContent(func, 8) == 0 ? "n/a" : GetColumnContent(func, 8).ToString()); return(item); }
private object GetColumnContent(ProfiledFunction func, int columnIndex) { switch (columnIndex) { case 0: return(GetFunctionName(func)); case 1: return(func.CallCount); case 2: return(func.InclusiveCycles); case 3: return((double)func.InclusiveCycles / _exclusiveTotal * 100); case 4: return(func.ExclusiveCycles); case 5: return((double)func.ExclusiveCycles / _exclusiveTotal * 100); case 6: return(func.CallCount == 0 ? 0 : (func.InclusiveCycles / func.CallCount)); case 7: return(func.MinCycles); case 8: return(func.MaxCycles); } throw new Exception("Invalid column index"); }
private string GetFunctionName(ProfiledFunction func) { string functionName; if (func.Address.Address == -1) { functionName = "[Reset]"; } else { CodeLabel label = LabelManager.GetLabel((UInt32)func.Address.Address, func.Address.Type); switch (func.Address.Type) { case AddressType.PrgRom: functionName = "PRG: $"; break; case AddressType.Register: functionName = "REG: $"; break; case AddressType.SaveRam: functionName = "SRAM: $"; break; case AddressType.WorkRam: functionName = "WRAM: $"; break; case AddressType.InternalRam: functionName = "RAM: $"; break; default: throw new Exception("Unsupported type"); } functionName += func.Address.Address.ToString("X4"); if (label != null) { functionName = label.Label + " (" + functionName + ")"; } } return(functionName); }