benchmark_toolbox: fps and tab reorder

This commit is contained in:
souldbminersmwc
2026-06-11 19:19:46 -04:00
parent 319fa2bf8f
commit 32dbdcabca
4 changed files with 59 additions and 1 deletions

View File

@@ -1064,6 +1064,10 @@ static std::chrono::time_point<std::chrono::high_resolution_clock> s_frameStartT
static std::atomic<float> s_currentCpuFps{ 0.0f };
static std::atomic<float> s_lastCpuLatencyMs{ 0.0f };
extern "C" float bhrt_cpu_fps(void) {
return s_currentCpuFps.load(std::memory_order_acquire);
}
alignas(64) static float s_deflectBuf[2][DEFLECT_W * DEFLECT_H * 4];
static std::atomic<int> s_deflectReadBuf{ 0 };
static std::atomic<bool> s_deflectReady{ true };

View File

@@ -33,6 +33,8 @@ namespace {
std::thread g_thread;
std::atomic<bool> g_stop{ false };
std::atomic<bool> g_running{ false };
std::atomic<float> g_fps{ 0.0f };
std::atomic<int> g_which{ -1 };
EGLDisplay s_dpy = EGL_NO_DISPLAY;
EGLContext s_ctx = EGL_NO_CONTEXT;
@@ -161,8 +163,11 @@ namespace {
}
void worker(int which) {
g_which.store(which);
g_fps.store(0.0f);
if (!eglUp()) {
eglDown();
g_which.store(-1);
g_running.store(false);
return;
}
@@ -184,6 +189,8 @@ namespace {
sceneInit(which);
const u64 frameNs = 16666666ULL;
u64 fpsT0 = armGetSystemTick();
int fpsFrames = 0;
while (!g_stop.load()) {
u64 t0 = armGetSystemTick();
glBindFramebuffer(GL_FRAMEBUFFER, fbo);
@@ -203,6 +210,14 @@ namespace {
u64 dt = armTicksToNs(armGetSystemTick() - t0);
if (dt < frameNs)
svcSleepThread(frameNs - dt);
fpsFrames++;
u64 elapsed = armTicksToNs(armGetSystemTick() - fpsT0);
if (elapsed >= 500000000ULL) {
g_fps.store((float)((double)fpsFrames * 1.0e9 / (double)elapsed));
fpsFrames = 0;
fpsT0 = armGetSystemTick();
}
}
sceneExit(which);
@@ -210,6 +225,8 @@ namespace {
glDeleteRenderbuffers(1, &rbColor);
glDeleteRenderbuffers(1, &rbDepth);
eglDown();
g_fps.store(0.0f);
g_which.store(-1);
g_running.store(false);
}
@@ -237,3 +254,13 @@ extern "C" void run_furmark_stop(void) {
extern "C" int run_furmark_running(void) {
return g_running.load() ? 1 : 0;
}
extern "C" float bhrt_cpu_fps(void);
extern "C" float run_furmark_fps(void) {
return g_fps.load();
}
extern "C" float run_furmark_cpu_fps(void) {
return (g_running.load() && g_which.load() == 3) ? bhrt_cpu_fps() : 0.0f;
}

View File

@@ -7,6 +7,8 @@ extern "C" {
void run_furmark_start(int which);
void run_furmark_stop(void);
int run_furmark_running(void);
float run_furmark_fps(void);
float run_furmark_cpu_fps(void);
#ifdef __cplusplus
}

View File

@@ -442,7 +442,18 @@ class FurmarkTab : public brls::Box {
auto *info = new brls::Label();
info->setText(desc);
info->setMarginBottom(8.0f);
this->addView(info);
auto *h = new brls::Header();
h->setTitle("Info");
this->addView(h);
if (which == 3) {
gpuFpsL = makeRow(this, "GPU FPS");
cpuFpsL = makeRow(this, "CPU FPS");
} else {
gpuFpsL = makeRow(this, "FPS");
}
}
~FurmarkTab() override {
@@ -462,6 +473,16 @@ class FurmarkTab : public brls::Box {
shown = r;
toggle->setText(r ? "Stop" : "Start");
statusL->setText(r ? "Running..." : "Stopped");
if (!r) {
gpuFpsL->setText("-");
if (cpuFpsL)
cpuFpsL->setText("-");
}
}
if (r) {
gpuFpsL->setText(fstr("%.1f", run_furmark_fps()));
if (cpuFpsL)
cpuFpsL->setText(fstr("%.1f", run_furmark_cpu_fps()));
}
brls::Box::frame(fc);
}
@@ -477,6 +498,8 @@ class FurmarkTab : public brls::Box {
bool shown = false;
brls::Button *toggle;
brls::Label *statusL;
brls::Label *gpuFpsL = nullptr;
brls::Label *cpuFpsL = nullptr;
};
class MemtesterTab : public brls::Box {
@@ -890,6 +913,9 @@ class MainActivity : public brls::Activity {
tab->setIconFromRes("img/logo.png");
tab->addTab("System Info", [] { return new SysInfoTab(); });
tab->addHeader("Combined");
tab->addTab("Black Hole", [] { return new FurmarkTab(3, "CPU+GPU black-hole."); });
tab->addHeader("CPU");
tab->addTab("CPU Stress", [] { return new CpuStressTab(); });
tab->addTab("CPU Ray Trace", [] { return new FurmarkTab(4, "CPU Path Tracer"); });
@@ -898,7 +924,6 @@ class MainActivity : public brls::Activity {
tab->addTab("GPU Test", [] { return new StressTab(); });
tab->addTab("Furmark", [] { return new FurmarkTab(0, "FurMark for Switch (48 step)"); });
tab->addTab("GPU Path Trace", [] { return new FurmarkTab(2, "GPU Path Tracer"); });
tab->addTab("Black Hole", [] { return new FurmarkTab(3, "CPU+GPU black-hole."); });
tab->addHeader("RAM");
tab->addTab("Memtester", [] { return new MemtesterTab(); });