Files
secretpsxsplash/src/profiler.cpp
Jan Racek e51c06b012 hush
2026-03-24 13:01:47 +01:00

32 lines
811 B
C++

#include "profiler.hh"
#ifdef PSXSPLASH_PROFILER
using namespace psxsplash::debug;
// Writes address+name to the PCSX-Redux debugger variable registry.
static void pcsxRegisterVariable(void* address, const char* name) {
register void* a0 asm("a0") = address;
register const char* a1 asm("a1") = name;
__asm__ volatile("sb %0, 0x2081(%1)" : : "r"(255), "r"(0x1f800000), "r"(a0), "r"(a1));
}
void Profiler::initialize() {
reset();
pcsxRegisterVariable(&sectionTimes[0], "profiler.rendering");
pcsxRegisterVariable(&sectionTimes[1], "profiler.lua");
pcsxRegisterVariable(&sectionTimes[2], "profiler.controls");
pcsxRegisterVariable(&sectionTimes[3], "profiler.navmesh");
}
void Profiler::reset() {
for (auto &time : sectionTimes) {
time = 0;
}
}
#endif // PSXSPLASH_PROFILER