Add timing for all the basics.

This way we can see overall stats for a frame.
This commit is contained in:
Unknown W. Brackets 2015-07-03 12:05:08 -07:00
parent a262f18bd7
commit 8fdceba7ca
12 changed files with 46 additions and 3 deletions

View file

@ -20,6 +20,7 @@
#include <cstdio>
#include "base/logging.h"
#include "profiler/profiler.h"
#include "Common/MsgHandler.h"
#include "Common/StdMutex.h"
@ -583,6 +584,7 @@ void ForceCheck()
void Advance()
{
PROFILE_THIS_SCOPE("advance");
int cyclesExecuted = slicelength - currentMIPS->downcount;
globalTimer += cyclesExecuted;
currentMIPS->downcount = slicelength;

View file

@ -22,6 +22,7 @@
#include "base/logging.h"
#include "base/timeutil.h"
#include "profiler/profiler.h"
#include "Core/Config.h"
#include "Core/CoreTiming.h"
@ -521,6 +522,7 @@ void hleSetSteppingTime(double t)
void CallSyscall(MIPSOpcode op)
{
PROFILE_THIS_SCOPE("syscall");
double start = 0.0; // need to initialize to fix the race condition where g_Config.bShowDebugStats is enabled in the middle of this func.
if (g_Config.bShowDebugStats)
{

View file

@ -31,6 +31,7 @@
// and move everything into native...
#include "base/logging.h"
#include "base/timeutil.h"
#include "profiler/profiler.h"
#ifndef _XBOX
#include "gfx_es2/gl_state.h"
@ -489,6 +490,7 @@ static bool FrameTimingThrottled() {
// Let's collect all the throttling and frameskipping logic here.
static void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) {
PROFILE_THIS_SCOPE("timing");
int fpsLimiter = PSP_CoreParameter().fpsLimit;
throttle = FrameTimingThrottled();
skipFrame = false;
@ -568,6 +570,7 @@ static void DoFrameTiming(bool &throttle, bool &skipFrame, float timestep) {
}
static void DoFrameIdleTiming() {
PROFILE_THIS_SCOPE("timing");
if (!FrameTimingThrottled() || !g_Config.bEnableSound || wasPaused) {
return;
}
@ -727,6 +730,7 @@ void hleLagSync(u64 userdata, int cyclesLate) {
// The goal here is to prevent network, audio, and input lag from the real world.
// Our normal timing is very "stop and go". This is efficient, but causes real world lag.
// This event (optionally) runs every 1ms to sync with the real world.
PROFILE_THIS_SCOPE("timing");
if (!FrameTimingThrottled()) {
lagSyncScheduled = false;

View file

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "profiler/profiler.h"
#include "Core/Reporting.h"
#include "Core/Config.h"
#include "Core/MemMap.h"
@ -607,6 +609,11 @@ void ArmJit::Comp_Syscall(MIPSOpcode op)
FlushAll();
SaveDowncount();
#ifdef USE_PROFILER
// When profiling, we can't skip CallSyscall, since it times syscalls.
gpr.SetRegImm(R0, op.encoding);
QuickCallFunction(R1, (void *)&CallSyscall);
#else
// Skip the CallSyscall where possible.
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc)
@ -620,6 +627,7 @@ void ArmJit::Comp_Syscall(MIPSOpcode op)
gpr.SetRegImm(R0, op.encoding);
QuickCallFunction(R1, (void *)&CallSyscall);
}
#endif
ApplyRoundingMode();
RestoreDowncount();

View file

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "base/logging.h"
#include "profiler/profiler.h"
#include "Common/ChunkFile.h"
#include "Core/Reporting.h"
@ -195,6 +196,7 @@ void ArmJit::CompileDelaySlot(int flags)
void ArmJit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
ClearCache();
}
@ -230,8 +232,8 @@ void ArmJit::Compile(u32 em_address) {
}
}
void ArmJit::RunLoopUntil(u64 globalticks)
{
void ArmJit::RunLoopUntil(u64 globalticks) {
PROFILE_THIS_SCOPE("jit");
((void (*)())enterCode)();
}

View file

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "profiler/profiler.h"
#include "Core/Reporting.h"
#include "Core/Config.h"
#include "Core/MemMap.h"
@ -590,6 +592,11 @@ void Arm64Jit::Comp_Syscall(MIPSOpcode op)
FlushAll();
SaveDowncount();
#ifdef USE_PROFILER
// When profiling, we can't skip CallSyscall, since it times syscalls.
MOVI2R(W0, op.encoding);
QuickCallFunction(X1, (void *)&CallSyscall);
#else
// Skip the CallSyscall where possible.
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc) {
@ -600,6 +607,7 @@ void Arm64Jit::Comp_Syscall(MIPSOpcode op)
MOVI2R(W0, op.encoding);
QuickCallFunction(X1, (void *)&CallSyscall);
}
#endif
ApplyRoundingMode();
RestoreDowncount();

View file

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "base/logging.h"
#include "profiler/profiler.h"
#include "Common/ChunkFile.h"
#include "Common/CPUDetect.h"
@ -179,6 +180,7 @@ void Arm64Jit::CompileDelaySlot(int flags) {
void Arm64Jit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
INFO_LOG(JIT, "Space left: %i", GetSpaceLeft());
ClearCache();
@ -217,6 +219,7 @@ void Arm64Jit::Compile(u32 em_address) {
}
void Arm64Jit::RunLoopUntil(u64 globalticks) {
PROFILE_THIS_SCOPE("jit");
((void (*)())enterCode)();
}

View file

@ -16,6 +16,7 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "base/logging.h"
#include "profiler/profiler.h"
#include "Common/ChunkFile.h"
#include "Core/Reporting.h"
#include "Core/Config.h"
@ -137,6 +138,7 @@ void MipsJit::CompileDelaySlot(int flags)
void MipsJit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
if (GetSpaceLeft() < 0x10000 || blocks.IsFull()) {
ClearCache();
}
@ -163,6 +165,7 @@ void MipsJit::Compile(u32 em_address) {
void MipsJit::RunLoopUntil(u64 globalticks)
{
PROFILE_THIS_SCOPE("jit");
((void (*)())enterCode)();
}

View file

@ -15,6 +15,8 @@
// Official git repository and contact information can be found at
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "profiler/profiler.h"
#include "Core/Reporting.h"
#include "Core/Config.h"
#include "Core/HLE/HLE.h"
@ -775,12 +777,17 @@ void Jit::Comp_Syscall(MIPSOpcode op)
RestoreRoundingMode();
js.downcountAmount = -offset;
#ifdef USE_PROFILER
// When profiling, we can't skip CallSyscall, since it times syscalls.
ABI_CallFunctionC(&CallSyscall, op.encoding);
#else
// Skip the CallSyscall where possible.
void *quickFunc = GetQuickSyscallFunc(op);
if (quickFunc)
ABI_CallFunctionP(quickFunc, (void *)GetSyscallInfo(op));
else
ABI_CallFunctionC(&CallSyscall, op.encoding);
#endif
ApplyRoundingMode();
WriteSyscallExit();

View file

@ -19,6 +19,7 @@
#include <iterator>
#include "math/math_util.h"
#include "profiler/profiler.h"
#include "Common/ChunkFile.h"
#include "Core/Core.h"
@ -347,6 +348,7 @@ void Jit::EatInstruction(MIPSOpcode op)
void Jit::Compile(u32 em_address)
{
PROFILE_THIS_SCOPE("jitc");
if (GetSpaceLeft() < 0x10000 || blocks.IsFull())
{
ClearCache();
@ -385,6 +387,7 @@ void Jit::Compile(u32 em_address)
void Jit::RunLoopUntil(u64 globalticks)
{
PROFILE_THIS_SCOPE("jit");
((void (*)())asm_.enterCode)();
}

View file

@ -804,7 +804,7 @@ void GLES_GPU::Execute_Prim(u32 op, u32 diff) {
return;
}
// This also make skipping drawing very effective.
// This also makes skipping drawing very effective.
framebufferManager_.SetRenderFrameBuffer();
if (gstate_c.skipDrawReason & (SKIPDRAW_SKIPFRAME | SKIPDRAW_NON_DISPLAYED_FB)) {
transformDraw_.SetupVertexDecoder(gstate.vertType);

View file

@ -578,6 +578,7 @@ void TransformDrawEngine::FreeBuffer(GLuint buf) {
}
void TransformDrawEngine::DoFlush() {
PROFILE_THIS_SCOPE("flush");
gpuStats.numFlushes++;
gpuStats.numTrackedVertexArrays = (int)vai_.size();