Debug events counter (#748)
* DBG+GUI: Debug events counter * DBG+GUI: Debug events counter * DBG+GUI: Debug events counter * DBG+GUI: Debug events counter * DBG+GUI: Debug events counter
This commit is contained in:
parent
db6d4fbc73
commit
1e1b1f14a0
|
|
@ -331,4 +331,5 @@ void dbgfunctionsinit()
|
|||
_dbgfunctions.EnumHandles = _enumhandles;
|
||||
_dbgfunctions.GetHandleName = _gethandlename;
|
||||
_dbgfunctions.EnumTcpConnections = _enumtcpconnections;
|
||||
_dbgfunctions.GetDbgEvents = dbggetdbgevents;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ typedef TRACERECORDTYPE(*GETTRACERECORDTYPE)(duint pageAddress);
|
|||
typedef bool(*ENUMHANDLES)(ListOf(HANDLEINFO) handles);
|
||||
typedef bool(*GETHANDLENAME)(duint handle, char* name, size_t nameSize, char* typeName, size_t typeNameSize);
|
||||
typedef bool(*ENUMTCPCONNECTIONS)(ListOf(TCPCONNECTIONINFO) connections);
|
||||
typedef duint(*GETDBGEVENTS)();
|
||||
|
||||
typedef struct DBGFUNCTIONS_
|
||||
{
|
||||
|
|
@ -190,6 +191,7 @@ typedef struct DBGFUNCTIONS_
|
|||
ENUMHANDLES EnumHandles;
|
||||
GETHANDLENAME GetHandleName;
|
||||
ENUMTCPCONNECTIONS EnumTcpConnections;
|
||||
GETDBGEVENTS GetDbgEvents;
|
||||
} DBGFUNCTIONS;
|
||||
|
||||
#ifdef BUILD_DBG
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ HANDLE hActiveThread;
|
|||
HANDLE hProcessToken;
|
||||
bool bUndecorateSymbolNames = true;
|
||||
bool bEnableSourceDebugging = true;
|
||||
duint DbgEvents = 0;
|
||||
|
||||
static DWORD WINAPI memMapThread(void* ptr)
|
||||
{
|
||||
|
|
@ -212,6 +213,11 @@ bool dbgcmddel(const char* name)
|
|||
return true;
|
||||
}
|
||||
|
||||
duint dbggetdbgevents()
|
||||
{
|
||||
return InterlockedExchange(&DbgEvents, 0);
|
||||
}
|
||||
|
||||
DWORD WINAPI updateCallStackThread(void* ptr)
|
||||
{
|
||||
GuiUpdateCallStack();
|
||||
|
|
@ -1358,6 +1364,7 @@ static void cbException(EXCEPTION_DEBUG_INFO* ExceptionData)
|
|||
|
||||
static void cbDebugEvent(DEBUG_EVENT* DebugEvent)
|
||||
{
|
||||
InterlockedIncrement(&DbgEvents);
|
||||
PLUG_CB_DEBUGEVENT debugEventInfo;
|
||||
debugEventInfo.DebugEvent = DebugEvent;
|
||||
plugincbcall(CB_DEBUGEVENT, &debugEventInfo);
|
||||
|
|
|
|||
|
|
@ -84,6 +84,7 @@ bool dbgsetcmdline(const char* cmd_line, cmdline_error_t* cmd_line_error);
|
|||
bool dbggetcmdline(char** cmd_line, cmdline_error_t* cmd_line_error);
|
||||
void dbgstartscriptthread(CBPLUGINSCRIPT cbScript);
|
||||
duint dbggetdebuggedbase();
|
||||
duint dbggetdbgevents();
|
||||
|
||||
void cbStep();
|
||||
void cbRtrStep();
|
||||
|
|
|
|||
|
|
@ -11,10 +11,18 @@ TimeWastedCounter::TimeWastedCounter(QObject* parent, QLabel* label)
|
|||
|
||||
void TimeWastedCounter::updateTimeWastedCounter()
|
||||
{
|
||||
duint timeWasted = DbgGetTimeWastedCounter();
|
||||
int days = timeWasted / (60 * 60 * 24);
|
||||
int hours = (timeWasted / (60 * 60)) % 24;
|
||||
int minutes = (timeWasted / 60) % 60;
|
||||
int seconds = timeWasted % 60;
|
||||
mLabel->setText(tr("Time Wasted Debugging:") + QString().sprintf(" %d:%02d:%02d:%02d", days, hours, minutes, seconds));
|
||||
duint dbgEvents = DbgFunctions()->GetDbgEvents();
|
||||
if(dbgEvents > 4)
|
||||
{
|
||||
mLabel->setText(tr("%1 events/s").arg(dbgEvents));
|
||||
}
|
||||
else
|
||||
{
|
||||
duint timeWasted = DbgGetTimeWastedCounter();
|
||||
int days = timeWasted / (60 * 60 * 24);
|
||||
int hours = (timeWasted / (60 * 60)) % 24;
|
||||
int minutes = (timeWasted / 60) % 60;
|
||||
int seconds = timeWasted % 60;
|
||||
mLabel->setText(tr("Time Wasted Debugging:") + QString().sprintf(" %d:%02d:%02d:%02d", days, hours, minutes, seconds));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue