Measure avg frame-time per sec
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
#include <PSX/GPU/gpu.hpp>
|
||||
#include <PSX/GPU/gpu_primitives.hpp>
|
||||
#include <PSX/Timer/frame_timer.hpp>
|
||||
#include <PSX/Timer/high_res_timer.hpp>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace JabyEngine;
|
||||
@@ -35,28 +34,15 @@ static void render() {
|
||||
}
|
||||
|
||||
void main() {
|
||||
static constexpr size_t MaxRounds = 1;
|
||||
|
||||
size_t avg = 0;
|
||||
size_t cur_rounds = 0;
|
||||
setup();
|
||||
|
||||
Overlay::mesaure_busy_loop();
|
||||
Overlay::TimerTest::mesaure_busy_loop();
|
||||
JabyEngine::HighResTime::enable();
|
||||
|
||||
while(true) {
|
||||
const auto start = JabyEngine::HighResTime::get_time_stamp();
|
||||
update();
|
||||
render();
|
||||
const auto end = JabyEngine::HighResTime::get_time_stamp();
|
||||
|
||||
avg += start.microseconds_to(end);
|
||||
cur_rounds++;
|
||||
if(cur_rounds == GPU::Display::frames_per_sec) {
|
||||
printf("AVG Time: %ius\n", avg/MaxRounds);
|
||||
|
||||
avg = 0;
|
||||
cur_rounds = 0;
|
||||
}
|
||||
const auto start = Overlay::TimerTest::start_measuring();
|
||||
update();
|
||||
render();
|
||||
Overlay::TimerTest::end_measuring(start, GPU::Display::frames_per_sec);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user