mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-18 08:50:29 +02:00
Simplify collecting time into debug counters
This commit is contained in:
1 parent
74b750e30d
commit
024cb73716
2 files changed
+19
-14
No files matched your search
@@ -45,3 +45,19 @@ private:
|
||||
int64_t nsecs_;
|
||||
#endif
|
||||
};
|
||||
|
||||
class TimeCollector {
|
||||
public:
|
||||
TimeCollector(double *target, bool enable) : target_(enable ? target : nullptr) {
|
||||
if (enable)
|
||||
startTime_ = time_now_d();
|
||||
}
|
||||
~TimeCollector() {
|
||||
if (target_) {
|
||||
*target_ += time_now_d() - startTime_;
|
||||
}
|
||||
}
|
||||
private:
|
||||
double startTime_;
|
||||
double *target_;
|
||||
};
|
||||
+3
-14
@@ -616,14 +616,7 @@ u32 GPUCommon::Break(int mode) {
|
||||
}
|
||||
|
||||
bool GPUCommon::InterpretList(DisplayList &list) {
|
||||
// Initialized to avoid a race condition with bShowDebugStats changing.
|
||||
double start = 0.0;
|
||||
if (coreCollectDebugStats) {
|
||||
start = time_now_d();
|
||||
}
|
||||
|
||||
// TODO: Need to be careful when *resuming* a list (when it wasn't from a stall...)
|
||||
|
||||
if (list.state == PSP_GE_DL_STATE_PAUSED)
|
||||
return false;
|
||||
currentList = &list;
|
||||
@@ -668,9 +661,6 @@ bool GPUCommon::InterpretList(DisplayList &list) {
|
||||
FinishDeferred();
|
||||
_dbg_assert_(!GPURecord::IsActive());
|
||||
gpuState = GPUSTATE_BREAK;
|
||||
if (coreCollectDebugStats) {
|
||||
gpuStats.msProcessingDisplayLists += time_now_d() - start;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -693,9 +683,6 @@ bool GPUCommon::InterpretList(DisplayList &list) {
|
||||
|
||||
list.offsetAddr = gstate_c.offsetAddr;
|
||||
|
||||
if (coreCollectDebugStats) {
|
||||
gpuStats.msProcessingDisplayLists += time_now_d() - start;
|
||||
}
|
||||
return gpuState == GPUSTATE_DONE || gpuState == GPUSTATE_ERROR;
|
||||
}
|
||||
|
||||
@@ -830,12 +817,14 @@ DLResult GPUCommon::ProcessDLQueue() {
|
||||
startingTicks = CoreTiming::GetTicks();
|
||||
cyclesExecuted = 0;
|
||||
|
||||
// Seems to be correct behaviour to process the list anyway?
|
||||
// ?? Seems to be correct behaviour to process the list anyway?
|
||||
if (startingTicks < busyTicks) {
|
||||
DEBUG_LOG(Log::G3D, "Can't execute a list yet, still busy for %lld ticks", busyTicks - startingTicks);
|
||||
//return;
|
||||
}
|
||||
|
||||
TimeCollector collectStat(&gpuStats.msProcessingDisplayLists, coreCollectDebugStats);
|
||||
|
||||
for (int listIndex = GetNextListIndex(); listIndex != -1; listIndex = GetNextListIndex()) {
|
||||
DisplayList &l = dls[listIndex];
|
||||
DEBUG_LOG(Log::G3D, "%s DL execution at %08x - stall = %08x (startingTicks=%d)", l.pc == l.startpc ? "Starting" : "Resuming", l.pc, l.stall, startingTicks);
|
||||
|
||||
Reference in new issue
Block a user