mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Merge pull request #7841 from unknownbrackets/frame-profiler
Count more in frame profiler, tweaks
This commit is contained in:
commit
0ffffb41bd
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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)();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
||||
|
@ -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)();
|
||||
}
|
||||
|
||||
|
@ -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)();
|
||||
}
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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)();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -578,6 +578,7 @@ void TransformDrawEngine::FreeBuffer(GLuint buf) {
|
||||
}
|
||||
|
||||
void TransformDrawEngine::DoFlush() {
|
||||
PROFILE_THIS_SCOPE("flush");
|
||||
gpuStats.numFlushes++;
|
||||
gpuStats.numTrackedVertexArrays = (int)vai_.size();
|
||||
|
||||
|
@ -805,46 +805,76 @@ static const uint32_t nice_colors[] = {
|
||||
0x33FFFF,
|
||||
};
|
||||
|
||||
enum ProfileCatStatus {
|
||||
PROFILE_CAT_VISIBLE = 0,
|
||||
PROFILE_CAT_IGNORE = 1,
|
||||
PROFILE_CAT_NOLEGEND = 2,
|
||||
};
|
||||
|
||||
void DrawProfile(UIContext &ui) {
|
||||
#ifdef USE_PROFILER
|
||||
int numCategories = Profiler_GetNumCategories();
|
||||
int historyLength = Profiler_GetHistoryLength();
|
||||
|
||||
ui.SetFontStyle(ui.theme->uiFont);
|
||||
|
||||
static float lastMaxVal = 1.0f / 60.0f;
|
||||
float legendMinVal = lastMaxVal * (1.0f / 120.0f);
|
||||
|
||||
std::vector<float> history;
|
||||
std::vector<ProfileCatStatus> catStatus;
|
||||
history.resize(historyLength);
|
||||
catStatus.resize(numCategories);
|
||||
|
||||
float rowH = 30.0f;
|
||||
float legendHeight = 0.0f;
|
||||
float legendWidth = 80.0f;
|
||||
for (int i = 0; i < numCategories; i++) {
|
||||
const char *name = Profiler_GetCategoryName(i);
|
||||
if (!strcmp(name, "timing")) {
|
||||
catStatus[i] = PROFILE_CAT_IGNORE;
|
||||
continue;
|
||||
}
|
||||
|
||||
Profiler_GetHistory(i, &history[0], historyLength);
|
||||
catStatus[i] = PROFILE_CAT_NOLEGEND;
|
||||
for (int j = 0; j < historyLength; ++j) {
|
||||
if (history[j] > legendMinVal) {
|
||||
catStatus[i] = PROFILE_CAT_VISIBLE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// So they don't move horizontally, we always measure.
|
||||
float w = 0.0f, h = 0.0f;
|
||||
ui.MeasureText(ui.GetFontStyle(), name, &w, &h);
|
||||
if (w > legendWidth) {
|
||||
legendWidth = w;
|
||||
}
|
||||
legendHeight += rowH;
|
||||
}
|
||||
legendWidth += 20.0f;
|
||||
|
||||
float rowH = 30.0f;
|
||||
float legendHeight = rowH * numCategories;
|
||||
float legendStartY = legendHeight > ui.GetBounds().centerY() ? ui.GetBounds().y2() - legendHeight : ui.GetBounds().centerY();
|
||||
float legendStartX = ui.GetBounds().x2() - std::min(legendWidth, 200.0f);
|
||||
|
||||
const uint32_t opacity = 140 << 24;
|
||||
|
||||
int legendNum = 0;
|
||||
for (int i = 0; i < numCategories; i++) {
|
||||
const char *name = Profiler_GetCategoryName(i);
|
||||
uint32_t color = nice_colors[i % ARRAY_SIZE(nice_colors)];
|
||||
|
||||
float y = legendStartY + i * rowH;
|
||||
ui.FillRect(UI::Drawable(opacity | color), Bounds(legendStartX, y, rowH - 2, rowH - 2));
|
||||
ui.DrawTextShadow(name, legendStartX + rowH + 2, y, 0xFFFFFFFF, ALIGN_VBASELINE);
|
||||
if (catStatus[i] == PROFILE_CAT_VISIBLE) {
|
||||
float y = legendStartY + legendNum++ * rowH;
|
||||
ui.FillRect(UI::Drawable(opacity | color), Bounds(legendStartX, y, rowH - 2, rowH - 2));
|
||||
ui.DrawTextShadow(name, legendStartX + rowH + 2, y, 0xFFFFFFFF, ALIGN_VBASELINE);
|
||||
}
|
||||
}
|
||||
|
||||
float graphWidth = ui.GetBounds().x2() - legendWidth - 20.0f;
|
||||
float graphHeight = ui.GetBounds().h * 0.8f;
|
||||
|
||||
std::vector<float> history;
|
||||
std::vector<float> total;
|
||||
history.resize(historyLength);
|
||||
total.resize(historyLength);
|
||||
|
||||
float dx = graphWidth / historyLength;
|
||||
|
||||
/*
|
||||
@ -854,7 +884,6 @@ void DrawProfile(UIContext &ui) {
|
||||
*/
|
||||
|
||||
bool area = true;
|
||||
static float lastMaxVal = 1.0f / 60.0f;
|
||||
float minVal = 0.0f;
|
||||
float maxVal = lastMaxVal; // TODO - adjust to frame length
|
||||
if (maxVal < 0.001f)
|
||||
@ -872,9 +901,15 @@ void DrawProfile(UIContext &ui) {
|
||||
ui.DrawTextShadow("1/60s", 5, y_60th, 0x80FFFF00);
|
||||
ui.DrawTextShadow("1ms", 5, y_1ms, 0x80FFFF00);
|
||||
|
||||
std::vector<float> total;
|
||||
total.resize(historyLength);
|
||||
|
||||
maxVal = 0.0f;
|
||||
float maxTotal = 0.0f;
|
||||
for (int i = 0; i < numCategories; i++) {
|
||||
if (catStatus[i] == PROFILE_CAT_IGNORE) {
|
||||
continue;
|
||||
}
|
||||
Profiler_GetHistory(i, &history[0], historyLength);
|
||||
|
||||
float x = 10;
|
||||
|
2
native
2
native
@ -1 +1 @@
|
||||
Subproject commit 670b2ff1e2506db44eb36141626b73bb45908420
|
||||
Subproject commit ad5301873f7db44eb4b13bc7592ffe511928325a
|
Loading…
Reference in New Issue
Block a user