feature: Added profiler which outputs to tty, removed subdivision entirely - to be remade later

This commit is contained in:
2025-09-04 18:04:30 +02:00
parent 8151f3864c
commit 55c1d2c39b
8 changed files with 314 additions and 311 deletions

32
src/profiler.cpp Normal file
View File

@@ -0,0 +1,32 @@
#include "profiler.hh"
#include "psyqo/xprintf.h"
using namespace psxsplash::debug;
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;
}
}
void Profiler::dumpToTTY() {
printf("profiler.rendering:%d,profiler.lua:%d,profiler.controls:%d,profiler.navmesh:%d\n", sectionTimes[0], sectionTimes[1], sectionTimes[2], sectionTimes[3]);
}