Debugger: Extend 'cycles' command to do (partial) timings relative to a user-specified instruction (#787) (PR #789)
This commit is contained in:
parent
13a4043118
commit
a8671f7a6a
6 changed files with 38 additions and 9 deletions
|
@ -6909,11 +6909,16 @@ Update_t CmdCyclesInfo(int nArgs)
|
|||
else
|
||||
{
|
||||
if (strcmp(g_aArgs[1].sArg, "abs") == 0)
|
||||
g_videoScannerDisplayInfo.isAbsCycle = true;
|
||||
g_videoScannerDisplayInfo.cycleMode = VideoScannerDisplayInfo::abs;
|
||||
else if (strcmp(g_aArgs[1].sArg, "rel") == 0)
|
||||
g_videoScannerDisplayInfo.isAbsCycle = false;
|
||||
g_videoScannerDisplayInfo.cycleMode = VideoScannerDisplayInfo::rel;
|
||||
else if (strcmp(g_aArgs[1].sArg, "part") == 0)
|
||||
g_videoScannerDisplayInfo.cycleMode = VideoScannerDisplayInfo::part;
|
||||
else
|
||||
return Help_Arg_1(CMD_CYCLES_INFO);
|
||||
|
||||
if (g_videoScannerDisplayInfo.cycleMode == VideoScannerDisplayInfo::part)
|
||||
CmdCyclesReset(0);
|
||||
}
|
||||
|
||||
TCHAR sText[CONSOLE_WIDTH];
|
||||
|
@ -6923,6 +6928,12 @@ Update_t CmdCyclesInfo(int nArgs)
|
|||
return UPDATE_ALL;
|
||||
}
|
||||
|
||||
Update_t CmdCyclesReset(int /*nArgs*/)
|
||||
{
|
||||
g_videoScannerDisplayInfo.savedCumulativeCycles = g_nCumulativeCycles;
|
||||
return UPDATE_ALL;
|
||||
}
|
||||
|
||||
// View ___________________________________________________________________________________________
|
||||
|
||||
// See: CmdWindowViewOutput (int nArgs)
|
||||
|
|
|
@ -123,6 +123,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||
{TEXT("PAGEDOWN4K" ) , CmdCursorPageDown4K , CMD_CURSOR_PAGE_DOWN_4K , "Scroll down 4096 bytes" }, // Ctrl
|
||||
// Cycles info
|
||||
{TEXT("CYCLES") , CmdCyclesInfo , CMD_CYCLES_INFO, "Cycles display configuration" },
|
||||
{TEXT("RCC") , CmdCyclesReset , CMD_CYCLES_RESET, "Reset cycles counter" },
|
||||
// Disassembler Data
|
||||
{TEXT("Z") , CmdDisasmDataDefByte1 , CMD_DISASM_DATA , "Treat byte [range] as data" },
|
||||
{TEXT("X") , CmdDisasmDataDefCode , CMD_DISASM_CODE , "Treat byte [range] as code" },
|
||||
|
|
|
@ -3789,8 +3789,15 @@ void DrawVideoScannerInfo (int line)
|
|||
PrintText("cycles:", rect);
|
||||
rect.left += nameWidth * nFontWidth;
|
||||
|
||||
UINT cycles = 0;
|
||||
if (g_videoScannerDisplayInfo.cycleMode == VideoScannerDisplayInfo::abs)
|
||||
cycles = (UINT)g_nCumulativeCycles;
|
||||
else if (g_videoScannerDisplayInfo.cycleMode == VideoScannerDisplayInfo::rel)
|
||||
cycles = g_videoScannerDisplayInfo.cycleDelta;
|
||||
else // "part"
|
||||
cycles = (UINT)g_videoScannerDisplayInfo.lastCumulativeCycles - (UINT)g_videoScannerDisplayInfo.savedCumulativeCycles;
|
||||
|
||||
char sValue[10];
|
||||
const UINT cycles = g_videoScannerDisplayInfo.isAbsCycle ? (UINT)g_nCumulativeCycles : g_videoScannerDisplayInfo.cycleDelta;
|
||||
sprintf_s(sValue, sizeof(sValue), "%08X", cycles);
|
||||
PrintText(sValue, rect);
|
||||
}
|
||||
|
|
|
@ -102,15 +102,17 @@
|
|||
class VideoScannerDisplayInfo
|
||||
{
|
||||
public:
|
||||
VideoScannerDisplayInfo(void) : isDecimal(false), isHorzReal(false), isAbsCycle(false),
|
||||
VideoScannerDisplayInfo(void) : isDecimal(false), isHorzReal(false), cycleMode(rel),
|
||||
lastCumulativeCycles(0), cycleDelta(0) {}
|
||||
void Reset(void) { lastCumulativeCycles = g_nCumulativeCycles; cycleDelta = 0; }
|
||||
void Reset(void) { lastCumulativeCycles = savedCumulativeCycles = g_nCumulativeCycles; cycleDelta = 0; }
|
||||
|
||||
bool isDecimal;
|
||||
bool isHorzReal;
|
||||
bool isAbsCycle;
|
||||
enum CYCLE_MODE {abs=0, rel, part};
|
||||
CYCLE_MODE cycleMode;
|
||||
|
||||
unsigned __int64 lastCumulativeCycles;
|
||||
unsigned __int64 savedCumulativeCycles;
|
||||
UINT cycleDelta;
|
||||
};
|
||||
|
||||
|
|
|
@ -1408,11 +1408,17 @@ Update_t CmdHelpSpecific (int nArgs)
|
|||
break;
|
||||
// Cycles
|
||||
case CMD_CYCLES_INFO:
|
||||
ConsoleColorizePrint(sText, " Usage: <abs|rel>");
|
||||
ConsoleColorizePrint(sText, " Usage: <abs|rel|part>");
|
||||
ConsoleBufferPush(" Where:");
|
||||
ConsoleBufferPush(" <abs|rel> changes cycle output to absolute/relative");
|
||||
ConsoleBufferPush(" abs = absolute number of cycles since power-on");
|
||||
ConsoleBufferPush(" rel = number of cycles since last step or breakpoint");
|
||||
ConsoleBufferPush(" part= number of cycles relative to current instruction");
|
||||
break;
|
||||
case CMD_CYCLES_RESET:
|
||||
ConsoleBufferPush(" Use in conjunctioned with 'cycles part' to reset to current instruction");
|
||||
break;
|
||||
// Video-Scanner
|
||||
|
||||
case CMD_VIDEO_SCANNER_INFO:
|
||||
ConsoleColorizePrint(sText, " Usage: <dec|hex|real|apple>");
|
||||
ConsoleBufferPush(" Where:");
|
||||
|
|
|
@ -377,6 +377,7 @@
|
|||
, CMD_CURSOR_PAGE_DOWN_4K // Down to nearest 4K boundary
|
||||
// Cycles info
|
||||
, CMD_CYCLES_INFO
|
||||
, CMD_CYCLES_RESET
|
||||
// Disassembler Data
|
||||
, CMD_DISASM_DATA
|
||||
, CMD_DISASM_CODE
|
||||
|
@ -666,7 +667,8 @@
|
|||
Update_t CmdCursorPageUp4K (int nArgs);
|
||||
|
||||
// Cycles info
|
||||
Update_t CmdCyclesInfo (int nArgs);
|
||||
Update_t CmdCyclesInfo (int nArgs);
|
||||
Update_t CmdCyclesReset (int nArgs);
|
||||
|
||||
// Disk
|
||||
Update_t CmdDisk (int nArgs);
|
||||
|
|
Loading…
Add table
Reference in a new issue