From 32dbdcabcaa35af2ed1ee9c3d46acc0800014fbc Mon Sep 17 00:00:00 2001 From: souldbminersmwc Date: Thu, 11 Jun 2026 19:19:46 -0400 Subject: [PATCH] benchmark_toolbox: fps and tab reorder --- .../Benchmark-Toolbox/source/furmark/BHRT.cpp | 4 +++ .../source/furmark/run_furmark.cpp | 27 +++++++++++++++++++ .../source/furmark/run_furmark.h | 2 ++ Source/Benchmark-Toolbox/source/main.cpp | 27 ++++++++++++++++++- 4 files changed, 59 insertions(+), 1 deletion(-) diff --git a/Source/Benchmark-Toolbox/source/furmark/BHRT.cpp b/Source/Benchmark-Toolbox/source/furmark/BHRT.cpp index f5df6f36..0384d3fb 100644 --- a/Source/Benchmark-Toolbox/source/furmark/BHRT.cpp +++ b/Source/Benchmark-Toolbox/source/furmark/BHRT.cpp @@ -1064,6 +1064,10 @@ static std::chrono::time_point s_frameStartT static std::atomic s_currentCpuFps{ 0.0f }; static std::atomic 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 s_deflectReadBuf{ 0 }; static std::atomic s_deflectReady{ true }; diff --git a/Source/Benchmark-Toolbox/source/furmark/run_furmark.cpp b/Source/Benchmark-Toolbox/source/furmark/run_furmark.cpp index c3fa92cb..95a388df 100644 --- a/Source/Benchmark-Toolbox/source/furmark/run_furmark.cpp +++ b/Source/Benchmark-Toolbox/source/furmark/run_furmark.cpp @@ -33,6 +33,8 @@ namespace { std::thread g_thread; std::atomic g_stop{ false }; std::atomic g_running{ false }; + std::atomic g_fps{ 0.0f }; + std::atomic 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; +} diff --git a/Source/Benchmark-Toolbox/source/furmark/run_furmark.h b/Source/Benchmark-Toolbox/source/furmark/run_furmark.h index 6b224fe8..c7297ed3 100644 --- a/Source/Benchmark-Toolbox/source/furmark/run_furmark.h +++ b/Source/Benchmark-Toolbox/source/furmark/run_furmark.h @@ -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 } diff --git a/Source/Benchmark-Toolbox/source/main.cpp b/Source/Benchmark-Toolbox/source/main.cpp index 46b48f73..14e75d1a 100644 --- a/Source/Benchmark-Toolbox/source/main.cpp +++ b/Source/Benchmark-Toolbox/source/main.cpp @@ -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(); });