Skip to content

Commit

Permalink
GE Debugger: Show time spent stepping.
Browse files Browse the repository at this point in the history
  • Loading branch information
unknownbrackets committed Sep 18, 2022
1 parent fc84f25 commit 5b5529b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions GPU/Debugger/Debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <vector>
#include "Common/Log.h"
#include "Common/StringUtils.h"
#include "Common/TimeUtil.h"
#include "GPU/GPU.h"
#include "GPU/Debugger/Breakpoints.h"
#include "GPU/Debugger/Debugger.h"
Expand All @@ -35,6 +36,8 @@ static int primsLastFrame = 0;
static int primsThisFrame = 0;
static int thisFlipNum = 0;

static double lastStepTime = -1.0;

static std::vector<std::pair<int, int>> restrictPrimRanges;
static std::string restrictPrimRule;

Expand All @@ -56,6 +59,7 @@ void SetActive(bool flag) {
breakNext = BreakNext::NONE;
breakAtCount = -1;
GPUStepping::ResumeFromStepping();
lastStepTime = -1.0;
}
}

Expand All @@ -79,6 +83,7 @@ void SetBreakNext(BreakNext next) {
GPUBreakpoints::AddCmdBreakpoint(GE_CMD_SPLINE, true);
}
GPUStepping::ResumeFromStepping();
lastStepTime = next == BreakNext::NONE ? -1.0 : time_now_d();
}

void SetBreakCount(int c, bool relative) {
Expand Down Expand Up @@ -130,7 +135,12 @@ bool NotifyCommand(u32 pc) {
GPUBreakpoints::ClearTempBreakpoints();

auto info = gpuDebug->DissassembleOp(pc);
NOTICE_LOG(G3D, "Waiting at %08x, %s", pc, info.desc.c_str());
if (lastStepTime >= 0.0) {
NOTICE_LOG(G3D, "Waiting at %08x, %s (%fms)", pc, info.desc.c_str(), (time_now_d() - lastStepTime) * 1000.0);
lastStepTime = -1.0;
} else {
NOTICE_LOG(G3D, "Waiting at %08x, %s", pc, info.desc.c_str());
}
GPUStepping::EnterStepping();
}

Expand All @@ -141,7 +151,12 @@ void NotifyDraw() {
if (!active)
return;
if (breakNext == BreakNext::DRAW && !GPUStepping::IsStepping()) {
NOTICE_LOG(G3D, "Waiting at a draw");
if (lastStepTime >= 0.0) {
NOTICE_LOG(G3D, "Waiting at a draw (%fms)", (time_now_d() - lastStepTime) * 1000.0);
lastStepTime = -1.0;
} else {
NOTICE_LOG(G3D, "Waiting at a draw");
}
GPUStepping::EnterStepping();
}
}
Expand Down

0 comments on commit 5b5529b

Please sign in to comment.