Skip to content

Commit

Permalink
Improve benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
IanSB committed Nov 15, 2021
1 parent cb3eaee commit c55af86
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
17 changes: 16 additions & 1 deletion src/rgb_to_fb.S
Expand Up @@ -2137,8 +2137,10 @@ benchmarkRAM:
cmp r0, #2
beq gpu_bench
cmp r0, #3
beq mbox_bench_1
beq gpio_bench
cmp r0, #4
beq mbox_bench_1
cmp r0, #5
beq mbox_bench_3
// RAM address in r0 returns with time in r0
mov r1, r0
Expand All @@ -2163,6 +2165,19 @@ benchloop2:
rsbmi r0, r0, #1
pop {r1-r12, pc}

gpio_bench:
ldr r4, =GPLEV0
ldr r1, =100000
READ_CYCLE_COUNTER r6
gpio_bench_loop:
ldr r8, [r4]
subs r1, r1, #1
bne gpio_bench_loop
READ_CYCLE_COUNTER r7
subs r0, r7, r6
rsbmi r0, r0, #1
pop {r1-r12, pc}

mbox_bench_1:
ldr r4, =GPU_DATA_0
ldr r1, =100000
Expand Down
7 changes: 4 additions & 3 deletions src/rgb_to_hdmi.c
Expand Up @@ -3045,9 +3045,10 @@ void rgb_to_hdmi_main() {
capinfo->sync_type = SYNC_BIT_COMPOSITE_SYNC;
current_display_buffer = 0;

log_info("ARM side single MBOX read = %d ns, Arm side triple MBOX read = %d ns", (int)((double) benchmarkRAM(3) * 1000 / cpuspeed / 100000 + 0.5), (int)((double) benchmarkRAM(4) * 1000 / cpuspeed / 300000 + 0.5));
log_info("GPU side GPIO read = %d ns, GPU side MBOX write = %d ns", (int)((double) benchmarkRAM(1) * 1000 / cpuspeed / 100000 + 0.5), (int)((double) benchmarkRAM(2) * 1000 / cpuspeed / 100000 + 0.5));
log_info("Cached RAM read = %d ns, Uncached screen RAM read = %d ns", (int)((double) benchmarkRAM(0x2000000) * 1000 / cpuspeed / 100000 + 0.5), (int)((double) benchmarkRAM(0x01e000000) * 1000 / cpuspeed / 100000 + 0.5));
int triple = (int)((double) benchmarkRAM(5) * 1000 / cpuspeed / 100000 + 0.5);
log_info("ARM: GPIO read = %dns, MBOX read = %dns, Triple MBOX read = %dns (%dns/word)", (int)((double) benchmarkRAM(3) * 1000 / cpuspeed / 100000 + 0.5), (int)((double) benchmarkRAM(4) * 1000 / cpuspeed / 100000 + 0.5), triple, triple / 3);
log_info("GPU: GPIO read = %dns, MBOX write = %dns", (int)((double) benchmarkRAM(1) * 1000 / cpuspeed / 100000 + 0.5), (int)((double) benchmarkRAM(2) * 1000 / cpuspeed / 100000 + 0.5));
log_info("RAM: Cached read = %dns, Uncached screen read = %dns", (int)((double) benchmarkRAM(0x2000000) * 1000 / cpuspeed / 100000 + 0.5), (int)((double) benchmarkRAM(0x01e000000) * 1000 / cpuspeed / 100000 + 0.5));

#ifdef USE_ARM_CAPTURE
log_info("Running ARM capture build");
Expand Down

0 comments on commit c55af86

Please sign in to comment.