Change some stat arrays from double to float (to save mem bandwidth)

This commit is contained in:
Henrik Rydgård committed 2025-06-18 11:00:27 +02:00
1 parent 702c84e019
commit cc3fbb22e4
4 files changed
+12 -12

No files matched your search

@@ -26,8 +26,8 @@ struct CollectedStats {
float fps;
float actual_fps;
char statbuf[4096];
std::vector<double> frameTimes;
std::vector<double> sleepTimes;
std::vector<float> frameTimes;
std::vector<float> sleepTimes;
int frameTimePos;
};
@@ -123,8 +123,8 @@ void WebSocketGPUStatsState::FlipListener() {
__DisplayGetDebugStats(stats.statbuf, sizeof(stats.statbuf));
int valid;
double *sleepHistory;
double *history = __DisplayGetFrameTimes(&valid, &stats.frameTimePos, &sleepHistory);
float *sleepHistory;
float *history = __DisplayGetFrameTimes(&valid, &stats.frameTimePos, &sleepHistory);
stats.frameTimes.resize(valid);
stats.sleepTimes.resize(valid);
+5 -5
View File
@@ -63,8 +63,8 @@ static int fpsHistoryPos = 0;
static int fpsHistoryValid = 0;
// Frame time stats.
static double frameTimeHistory[600];
static double frameSleepHistory[600];
static float frameTimeHistory[600];
static float frameSleepHistory[600];
static constexpr int frameTimeHistorySize = (int)ARRAY_SIZE(frameTimeHistory);
static int frameTimeHistoryPos = 0;
static int frameTimeHistoryValid = 0;
@@ -93,13 +93,13 @@ static void CalculateFPS() {
}
if ((DebugOverlay)g_Config.iDebugOverlay == DebugOverlay::FRAME_GRAPH || coreCollectDebugStats) {
frameTimeHistory[frameTimeHistoryPos++] = now - lastFrameTimeHistory;
frameTimeHistory[frameTimeHistoryPos++] = (float)(now - lastFrameTimeHistory);
lastFrameTimeHistory = now;
frameTimeHistoryPos = frameTimeHistoryPos % frameTimeHistorySize;
if (frameTimeHistoryValid < frameTimeHistorySize) {
++frameTimeHistoryValid;
}
frameSleepHistory[frameTimeHistoryPos] = 0.0;
frameSleepHistory[frameTimeHistoryPos] = 0.0f;
}
}
@@ -169,7 +169,7 @@ void DisplayAdjustAccumulatedHcount(uint32_t diff) {
hCountBase += diff;
}
double *__DisplayGetFrameTimes(int *out_valid, int *out_pos, double **out_sleep) {
float *__DisplayGetFrameTimes(int *out_valid, int *out_pos, float **out_sleep) {
*out_valid = frameTimeHistoryValid;
*out_pos = frameTimeHistoryPos;
*out_sleep = frameSleepHistory;
+1 -1
View File
@@ -42,7 +42,7 @@ void __DisplayGetDebugStats(char *stats, size_t bufsize);
void __DisplayGetAveragedFPS(float *out_vps, float *out_fps);
void __DisplayGetFPS(float *out_vps, float *out_fps, float *out_actual_fps);
void __DisplayGetVPS(float *out_vps);
double *__DisplayGetFrameTimes(int *out_valid, int *out_pos, double **out_sleep);
float *__DisplayGetFrameTimes(int *out_valid, int *out_pos, float **out_sleep);
int DisplayGetSleepPos();
void DisplayNotifySleep(double t, int pos = -1);
bool DisplayIsRunningSlow();
+2 -2
View File
@@ -97,9 +97,9 @@ static void DrawControlDebug(UIContext *ctx, const ControlMapper &mapper, const
static void DrawFrameTimes(UIContext *ctx, const Bounds &bounds) {
FontID ubuntu24("UBUNTU24");
double *sleepHistory;
float *sleepHistory;
int valid, pos;
double *history = __DisplayGetFrameTimes(&valid, &pos, &sleepHistory);
float *history = __DisplayGetFrameTimes(&valid, &pos, &sleepHistory);
int scale = 7000;
int width = 600;