Skip to content

Commit

Permalink
Count listsyncs and drawsyncs in gpu stats. Eat some cycles in listSync
Browse files Browse the repository at this point in the history
Chose a conservative number (same as sceGeContinue)
  • Loading branch information
hrydgard committed Feb 7, 2023
1 parent d1e0061 commit 9827dd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions Core/HLE/sceGe.cpp
Expand Up @@ -383,6 +383,7 @@ static int sceGeListUpdateStallAddr(u32 displayListID, u32 stallAddress) {
// 0 : wait for completion. 1:check and return
int sceGeListSync(u32 displayListID, u32 mode) {
DEBUG_LOG(SCEGE, "sceGeListSync(dlid=%08x, mode=%08x)", displayListID, mode);
hleEatCycles(220); // Fudged without measuring, copying sceGeContinue.
return gpu->ListSync(LIST_ID_MAGIC ^ displayListID, mode);
}

Expand Down
4 changes: 4 additions & 0 deletions GPU/GPU.h
Expand Up @@ -74,6 +74,8 @@ struct GPUStatistics {

void ResetFrame() {
numDrawCalls = 0;
numDrawSyncs = 0;
numListSyncs = 0;
numCachedDrawCalls = 0;
numVertsSubmitted = 0;
numCachedVertsDrawn = 0;
Expand Down Expand Up @@ -104,6 +106,8 @@ struct GPUStatistics {

// Per frame statistics
int numDrawCalls;
int numDrawSyncs;
int numListSyncs;
int numCachedDrawCalls;
int numFlushes;
int numVertsSubmitted;
Expand Down
8 changes: 7 additions & 1 deletion GPU/GPUCommon.cpp
Expand Up @@ -675,6 +675,8 @@ void GPUCommon::DumpNextFrame() {
}

u32 GPUCommon::DrawSync(int mode) {
gpuStats.numDrawSyncs++;

if (mode < 0 || mode > 1)
return SCE_KERNEL_ERROR_INVALID_MODE;

Expand Down Expand Up @@ -723,6 +725,8 @@ void GPUCommon::CheckDrawSync() {
}

int GPUCommon::ListSync(int listid, int mode) {
gpuStats.numListSyncs++;

if (listid < 0 || listid >= DisplayListMaxCount)
return SCE_KERNEL_ERROR_INVALID_ID;

Expand Down Expand Up @@ -3461,7 +3465,7 @@ void GPUCommon::UpdateUVScaleOffset() {
size_t GPUCommon::FormatGPUStatsCommon(char *buffer, size_t size) {
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
return snprintf(buffer, size,
"DL processing time: %0.2f ms\n"
"DL processing time: %0.2f ms, %d drawsync, %d listsync\n"
"Draw calls: %d, flushes %d, clears %d (cached: %d)\n"
"Num Tracked Vertex Arrays: %d\n"
"Vertices: %d cached: %d uncached: %d\n"
Expand All @@ -3471,6 +3475,8 @@ size_t GPUCommon::FormatGPUStatsCommon(char *buffer, size_t size) {
"Copies: depth %d, color %d, reint %d, blend %d, selftex %d\n"
"GPU cycles executed: %d (%f per vertex)\n",
gpuStats.msProcessingDisplayLists * 1000.0f,
gpuStats.numDrawSyncs,
gpuStats.numListSyncs,
gpuStats.numDrawCalls,
gpuStats.numFlushes,
gpuStats.numClears,
Expand Down

0 comments on commit 9827dd5

Please sign in to comment.