diff options
author | Bad Diode <bd@badd10de.dev> | 2023-08-30 11:40:36 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2023-08-30 11:40:36 +0200 |
commit | 81462f66b843b138240e7c6252c434d24a085afd (patch) | |
tree | 12e78aaad95ef2a3fa1f63162209df5355a1f148 /src | |
parent | 0845bb5aaa1a463c2d35ae6df5a3457441b767b5 (diff) | |
download | uxngba-81462f66b843b138240e7c6252c434d24a085afd.tar.gz uxngba-81462f66b843b138240e7c6252c434d24a085afd.zip |
Prepare for initial eval timing benchmark
Diffstat (limited to 'src')
-rw-r--r-- | src/config.c | 2 | ||||
-rw-r--r-- | src/main.c | 61 | ||||
-rw-r--r-- | src/profiling.c | 24 |
3 files changed, 34 insertions, 53 deletions
diff --git a/src/config.c b/src/config.c index d100233..42ad56b 100644 --- a/src/config.c +++ b/src/config.c | |||
@@ -8,4 +8,4 @@ | |||
8 | #define CONTROL_METHODS CONTROL_CONTROLLER,CONTROL_MOUSE,CONTROL_KEYBOARD | 8 | #define CONTROL_METHODS CONTROL_CONTROLLER,CONTROL_MOUSE,CONTROL_KEYBOARD |
9 | #endif | 9 | #endif |
10 | 10 | ||
11 | #define PROF_ENABLE 0 | 11 | #define PROF_ENABLE 2 |
@@ -274,7 +274,10 @@ main(void) { | |||
274 | // uxn_eval(&u, PAGE_PROGRAM); | 274 | // uxn_eval(&u, PAGE_PROGRAM); |
275 | u8 frame_counter = 0; | 275 | u8 frame_counter = 0; |
276 | 276 | ||
277 | uxn_eval_asm(PAGE_PROGRAM); | 277 | FRAME_START(); |
278 | PROF(uxn_eval_asm(PAGE_PROGRAM), eval_cycles); | ||
279 | FRAME_END(); | ||
280 | PROF_SHOW(); | ||
278 | 281 | ||
279 | // txt_printf("\nROM"); | 282 | // txt_printf("\nROM"); |
280 | // for (size_t i = 0; i < 32; i++) { | 283 | // for (size_t i = 0; i < 32; i++) { |
@@ -285,31 +288,31 @@ main(void) { | |||
285 | // } | 288 | // } |
286 | // txt_printf("\n"); | 289 | // txt_printf("\n"); |
287 | 290 | ||
288 | txt_printf("\nWST ("); | 291 | // txt_printf("\nWST ("); |
289 | txt_printf("SIZE: %d)", wst_ptr - (uintptr_t)wst); | 292 | // txt_printf("SIZE: %d)", wst_ptr - (uintptr_t)wst); |
290 | for (size_t i = 0; i < 32; i++) { | 293 | // for (size_t i = 0; i < 32; i++) { |
291 | if (i % 8 == 0) { | 294 | // if (i % 8 == 0) { |
292 | txt_printf("\n"); | 295 | // txt_printf("\n"); |
293 | } | 296 | // } |
294 | if (i >= (wst_ptr - (uintptr_t)wst)) { | 297 | // if (i >= (wst_ptr - (uintptr_t)wst)) { |
295 | txt_printf("%02x ", 0); | 298 | // txt_printf("%02x ", 0); |
296 | } else { | 299 | // } else { |
297 | txt_printf("%02x ", wst[i]); | 300 | // txt_printf("%02x ", wst[i]); |
298 | } | 301 | // } |
299 | } | 302 | // } |
300 | txt_printf("\n\n"); | 303 | // txt_printf("\n\n"); |
301 | txt_printf("RST ("); | 304 | // txt_printf("RST ("); |
302 | txt_printf("SIZE: %d)", rst_ptr - (uintptr_t)rst); | 305 | // txt_printf("SIZE: %d)", rst_ptr - (uintptr_t)rst); |
303 | for (size_t i = 0; i < 32; i++) { | 306 | // for (size_t i = 0; i < 32; i++) { |
304 | if (i % 8 == 0) { | 307 | // if (i % 8 == 0) { |
305 | txt_printf("\n"); | 308 | // txt_printf("\n"); |
306 | } | 309 | // } |
307 | if (i >= (rst_ptr - (uintptr_t)rst)) { | 310 | // if (i >= (rst_ptr - (uintptr_t)rst)) { |
308 | txt_printf("%02x ", 0); | 311 | // txt_printf("%02x ", 0); |
309 | } else { | 312 | // } else { |
310 | txt_printf("%02x ", rst[i]); | 313 | // txt_printf("%02x ", rst[i]); |
311 | } | 314 | // } |
312 | } | 315 | // } |
313 | // txt_printf("\n\n"); | 316 | // txt_printf("\n\n"); |
314 | // txt_printf("RAM (ZP)\n"); | 317 | // txt_printf("RAM (ZP)\n"); |
315 | // for (size_t i = 0; i < 64; i++) { | 318 | // for (size_t i = 0; i < 64; i++) { |
@@ -338,13 +341,13 @@ main(void) { | |||
338 | // // } | 341 | // // } |
339 | // FRAME_END(); | 342 | // FRAME_END(); |
340 | bios_vblank_wait(); | 343 | bios_vblank_wait(); |
341 | FRAME_START(); | 344 | // FRAME_START(); |
342 | flipbuf(); | 345 | flipbuf(); |
343 | // screen_fill(0); | 346 | // screen_fill(0); |
344 | // txt_printf("WST: 0x%08x\n", wst); | 347 | // txt_printf("WST: 0x%08x\n", wst); |
345 | // txt_printf("PTR: 0x%08x\n", wst_ptr); | 348 | // txt_printf("PTR: 0x%08x\n", wst_ptr); |
346 | FRAME_END(); | 349 | // FRAME_END(); |
347 | PROF_SHOW(); | 350 | // PROF_SHOW(); |
348 | // txt_render(); | 351 | // txt_render(); |
349 | // txt_clear(); | 352 | // txt_clear(); |
350 | } | 353 | } |
diff --git a/src/profiling.c b/src/profiling.c index 2d230df..9817eb1 100644 --- a/src/profiling.c +++ b/src/profiling.c | |||
@@ -39,29 +39,7 @@ | |||
39 | #define PROF_SHOW() \ | 39 | #define PROF_SHOW() \ |
40 | do { \ | 40 | do { \ |
41 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\ | 41 | txt_position((PROF_SHOW_X), (PROF_SHOW_Y));\ |
42 | txt_printf("INPUT %.8lu\n", avg_input_cycles);\ | 42 | txt_printf("N CYCLES: %.8lu\n", eval_cycles);\ |
43 | txt_printf("EVAL %.8lu\n", avg_eval_cycles);\ | ||
44 | txt_printf("VIDEO\n");\ | ||
45 | txt_printf(">PIX %.8lu\n", avg_ppu_pixel_cycles);\ | ||
46 | txt_printf(">FILL %.8lu\n", avg_ppu_fill_cycles);\ | ||
47 | txt_printf(">1BPP %.8lu\n", avg_ppu_icn_cycles);\ | ||
48 | txt_printf(">2BPP %.8lu\n", avg_ppu_chr_cycles);\ | ||
49 | txt_printf(">FLIP %.8lu\n", avg_flip_cycles);\ | ||
50 | txt_printf("AUDIO %.8lu\n", avg_mix_cycles);\ | ||
51 | txt_printf("TOTAL %.8lu\n", avg_frame_cycles);\ | ||
52 | u32 frame_time =\ | ||
53 | FP_DIV(\ | ||
54 | FP_NUM(avg_frame_cycles + 1, 2),\ | ||
55 | FP_NUM(2809, 2),\ | ||
56 | 2) * 166;\ | ||
57 | u32 fps =\ | ||
58 | FP_DIV(\ | ||
59 | FP_NUM(280896 * 60, 2),\ | ||
60 | FP_NUM(avg_frame_cycles + 1, 2),\ | ||
61 | 2);\ | ||
62 | txt_printf("TIME %.8lu\n", frame_time >> 2);\ | ||
63 | txt_printf("FPS %.8lu\n", (fps >> 2) + 1);\ | ||
64 | screen_fill(BG_BACK, 0, 0, 8 * 16, 8 * 12, 2);\ | ||
65 | } while (0) | 43 | } while (0) |
66 | 44 | ||
67 | static u32 prof_frame_counter = 0; | 45 | static u32 prof_frame_counter = 0; |