mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-21 14:41:39 +00:00
Log some additional things during reporting.
This commit is contained in:
parent
f93c92d409
commit
50eb11c66f
@ -115,6 +115,13 @@ enum {
|
||||
PSP_DISPLAY_SETBUF_NEXTFRAME = 1
|
||||
};
|
||||
|
||||
static int lastFpsFrame = 0;
|
||||
static double lastFpsTime = 0.0;
|
||||
static double fps = 0.0;
|
||||
static double fpsHistory[120];
|
||||
static size_t fpsHistoryPos = 0;
|
||||
static size_t fpsHistoryValid = 0;
|
||||
|
||||
void hleEnterVblank(u64 userdata, int cyclesLate);
|
||||
void hleLeaveVblank(u64 userdata, int cyclesLate);
|
||||
void hleAfterFlip(u64 userdata, int cyclesLate);
|
||||
@ -143,6 +150,9 @@ void __DisplayInit() {
|
||||
curFrameTime = 0.0;
|
||||
nextFrameTime = 0.0;
|
||||
|
||||
fpsHistoryPos = 0;
|
||||
fpsHistoryValid = 0;
|
||||
|
||||
InitGfxState();
|
||||
}
|
||||
|
||||
@ -203,15 +213,25 @@ void __DisplayFireVblank() {
|
||||
}
|
||||
}
|
||||
|
||||
static double highestFps = 0.0;
|
||||
static int lastFpsFrame = 0;
|
||||
static double lastFpsTime = 0.0;
|
||||
static double fps = 0.0;
|
||||
|
||||
void __DisplayGetFPS(float *out_vps, float *out_fps) {
|
||||
*out_vps = *out_fps = fps;
|
||||
}
|
||||
|
||||
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps) {
|
||||
float avg = 0.0;
|
||||
if (fpsHistoryValid > 0) {
|
||||
if (fpsHistoryValid > ARRAY_SIZE(fpsHistory)) {
|
||||
fpsHistoryValid = ARRAY_SIZE(fpsHistory);
|
||||
}
|
||||
for (size_t i = 0; i < fpsHistoryValid; ++i) {
|
||||
avg += fpsHistory[i];
|
||||
}
|
||||
avg /= (double) fpsHistoryValid;
|
||||
}
|
||||
|
||||
*out_vps = *out_fps = avg;
|
||||
}
|
||||
|
||||
void CalculateFPS()
|
||||
{
|
||||
time_update();
|
||||
@ -220,11 +240,13 @@ void CalculateFPS()
|
||||
if (now >= lastFpsTime + 1.0)
|
||||
{
|
||||
fps = (gpuStats.numFrames - lastFpsFrame) / (now - lastFpsTime);
|
||||
if (fps > highestFps)
|
||||
highestFps = fps;
|
||||
|
||||
lastFpsFrame = gpuStats.numFrames;
|
||||
lastFpsTime = now;
|
||||
|
||||
fpsHistory[fpsHistoryPos++] = fps;
|
||||
fpsHistoryPos = fpsHistoryPos % ARRAY_SIZE(fpsHistory);
|
||||
++fpsHistoryValid;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,3 +35,4 @@ void __DisplayListenVblank(VblankCallback callback);
|
||||
|
||||
void __DisplayGetDebugStats(char stats[2048]);
|
||||
void __DisplayGetFPS(float *out_vps, float *out_fps);
|
||||
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps);
|
||||
|
@ -19,8 +19,11 @@
|
||||
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/StdThread.h"
|
||||
#include "Core/CoreTiming.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/System.h"
|
||||
#include "Core/HLE/sceDisplay.h"
|
||||
#include "Core/HLE/sceKernelMemory.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
||||
@ -59,6 +62,45 @@ namespace Reporting
|
||||
AppendEscaped(value);
|
||||
}
|
||||
|
||||
void Add(const std::string &key, const char *value)
|
||||
{
|
||||
Add(key, std::string(value));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void AddT(const std::string &key, const char *fmt, const T value)
|
||||
{
|
||||
char temp[64];
|
||||
snprintf(temp, sizeof(temp), fmt, value);
|
||||
temp[sizeof(temp) - 1] = '\0';
|
||||
Add(key, temp);
|
||||
}
|
||||
|
||||
void Add(const std::string &key, const int value)
|
||||
{
|
||||
AddT(key, "%d", value);
|
||||
}
|
||||
|
||||
void Add(const std::string &key, const u32 value)
|
||||
{
|
||||
AddT(key, "%u", value);
|
||||
}
|
||||
|
||||
void Add(const std::string &key, const u64 value)
|
||||
{
|
||||
AddT(key, "%llu", value);
|
||||
}
|
||||
|
||||
void Add(const std::string &key, const double value)
|
||||
{
|
||||
AddT(key, "%f", value);
|
||||
}
|
||||
|
||||
void Add(const std::string &key, const bool value)
|
||||
{
|
||||
Add(key, value ? "true" : "false");
|
||||
}
|
||||
|
||||
// Percent encoding, aka application/x-www-form-urlencoded.
|
||||
void AppendEscaped(const std::string &value)
|
||||
{
|
||||
@ -255,6 +297,17 @@ namespace Reporting
|
||||
postdata.Add("gpu_full", gpuFull);
|
||||
postdata.Add("cpu", cpu_info.Summarize());
|
||||
postdata.Add("platform", GetPlatformIdentifer());
|
||||
postdata.Add("sdkver", sceKernelGetCompiledSdkVersion());
|
||||
postdata.Add("pixel_width", PSP_CoreParameter().pixelWidth);
|
||||
postdata.Add("pixel_height", PSP_CoreParameter().pixelHeight);
|
||||
postdata.Add("ticks", CoreTiming::GetTicks());
|
||||
|
||||
if (g_Config.bShowFPSCounter)
|
||||
{
|
||||
float vps, fps;
|
||||
__DisplayGetAveragedFPS(&vps, &fps);
|
||||
postdata.Add("vps", vps);
|
||||
}
|
||||
|
||||
// TODO: Settings, savestate/savedata status, some measure of speed/fps?
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user