Integrate time measurement

This commit is contained in:
jaby 2024-10-01 21:34:51 +02:00
parent 6680c4d5a3
commit a922403acc
2 changed files with 11 additions and 1 deletions

View File

@ -3,6 +3,7 @@
#include <PSX/GPU/gpu.hpp>
#include <PSX/GPU/make_gpu_primitives.hpp>
#include <PSX/Periphery/periphery.hpp>
#include <PSX/Timer/high_res_timer.hpp>
namespace GPUTest {
using namespace JabyEngine;
@ -120,7 +121,10 @@ namespace GPUTest {
void main() {
rect9.concat(rect10);
Shared::back_menu.reset();
HighResTime::enable();
auto start_time = HighResTime::get_time_stamp();
auto time_passed = 0;
while(true) {
// Update Phase
Periphery::query_controller();
@ -128,7 +132,13 @@ namespace GPUTest {
break;
}
auto cursor = FontWriter::update(Make::PositionI16((GPU::Display::Width - 160)/2, GPU::Display::Height - 32));
FontWriter::bios_font_writer.write(cursor, "Time: %ims", GPU::Color24::Blue(), time_passed);
GPU::swap_buffers_vsync(1);
const auto end_time = HighResTime::get_time_stamp();
time_passed = start_time.milliseconds_to(end_time);
start_time = end_time;
GPU::render(triangle1);
GPU::render(triangle2);
@ -159,5 +169,6 @@ namespace GPUTest {
GPU::render(rect9);
Shared::back_menu.render();
}
HighResTime::disable();
}
}

View File

@ -82,7 +82,6 @@ namespace JabyEngine {
return (0x1F801100 + (ID*0x10));
}
// TODO: Improve this to actually use it for measurement - if possible
static auto& Counter0 = __declare_io_value(struct Counter0, counter_base_adr(0));
static auto& Counter1 = __declare_io_value(struct Counter1, counter_base_adr(1));
static auto& Counter2 = __declare_io_value(struct Counter2, counter_base_adr(2));