Measure the busy loop for real hardware later

This commit is contained in:
Jaby 2023-04-26 19:09:49 +02:00
parent c1ff1187f9
commit 34f8602693
1 changed files with 16 additions and 0 deletions

View File

@ -1,5 +1,21 @@
#include <PSX/Timer/high_res_timer.hpp>
#include <stdio.h> #include <stdio.h>
extern "C" void busy_loop(int count);
static void mesaure_busy_loop() {
static constexpr auto Counts = 500;
JabyEngine::HighResTime::enable();
const auto start = JabyEngine::HighResTime::get_time_stamp();
busy_loop(Counts);
const auto end = JabyEngine::HighResTime::get_time_stamp();
JabyEngine::HighResTime::disable();
printf("Busy loop of %i took %ims %ins\n", Counts, start.milliseconds_to(end), start.microseconds_to(end));
}
void main() { void main() {
printf("Hello Planschbecken!\n"); printf("Hello Planschbecken!\n");
mesaure_busy_loop();
} }