Show statistics for GPU cycles executed per frame.

This commit is contained in:
Unknown W. Brackets 2013-05-31 10:40:16 -07:00
parent 58c992d3d0
commit 9c85bd92e4
4 changed files with 11 additions and 0 deletions

View File

@ -254,6 +254,8 @@ void __DisplayGetDebugStats(char stats[2048])
{
gpu->UpdateStats();
float vertexAverageCycles = gpuStats.numVertsSubmitted > 0 ? (float)gpuStats.vertexGPUCycles / (float)gpuStats.numVertsSubmitted : 0.0f;
sprintf(stats,
"Frames: %i\n"
"DL processing time: %0.2f ms\n"
@ -263,6 +265,7 @@ void __DisplayGetDebugStats(char stats[2048])
"Draw calls: %i, flushes %i\n"
"Cached Draw calls: %i\n"
"Num Tracked Vertex Arrays: %i\n"
"Cycles executed: %d (%f per vertex)\n"
"Vertices Submitted: %i\n"
"Cached Vertices Drawn: %i\n"
"Uncached Vertices Drawn: %i\n"
@ -283,6 +286,8 @@ void __DisplayGetDebugStats(char stats[2048])
gpuStats.numFlushes,
gpuStats.numCachedDrawCalls,
gpuStats.numTrackedVertexArrays,
gpuStats.vertexGPUCycles + gpuStats.otherGPUCycles,
vertexAverageCycles,
gpuStats.numVertsSubmitted,
gpuStats.numCachedVertsDrawn,
gpuStats.numUncachedVertsDrawn,

View File

@ -390,6 +390,7 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
transformDraw_.SubmitPrim(verts, inds, type, count, gstate.vertType, -1, &bytesRead);
int vertexCost = transformDraw_.EstimatePerVertexCost();
gpuStats.vertexGPUCycles += vertexCost * count;
cyclesExecuted += vertexCost * count;
// After drawing, we advance the vertexAddr (when non indexed) or indexAddr (when indexed).

View File

@ -463,6 +463,7 @@ inline void GPUCommon::UpdatePC(u32 currentPC, u32 newPC)
{
// Rough estimate, 2 CPU ticks (it's double the clock rate) per GPU instruction.
cyclesExecuted += 2 * (currentPC - cycleLastPC) / 4;
gpuStats.otherGPUCycles += 2 * (currentPC - cycleLastPC) / 4;
cycleLastPC = newPC == 0 ? currentPC : newPC;
// Exit the runloop and recalculate things. This isn't common.

View File

@ -302,6 +302,8 @@ struct GPUStatistics
numFlushes = 0;
numTexturesDecoded = 0;
msProcessingDisplayLists = 0;
vertexGPUCycles = 0;
otherGPUCycles = 0;
}
// Per frame statistics
@ -317,6 +319,8 @@ struct GPUStatistics
int numShaderSwitches;
int numTexturesDecoded;
double msProcessingDisplayLists;
int vertexGPUCycles;
int otherGPUCycles;
// Total statistics, updated by the GPU core in UpdateStats
int numFrames;