32 lines
811 B
C++
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(§ionTimes[0], "profiler.rendering");
|
|
pcsxRegisterVariable(§ionTimes[1], "profiler.lua");
|
|
pcsxRegisterVariable(§ionTimes[2], "profiler.controls");
|
|
pcsxRegisterVariable(§ionTimes[3], "profiler.navmesh");
|
|
}
|
|
|
|
void Profiler::reset() {
|
|
for (auto &time : sectionTimes) {
|
|
time = 0;
|
|
}
|
|
}
|
|
|
|
#endif // PSXSPLASH_PROFILER
|
|
|
|
|