Skip to content

Commit 33e31e7

Browse files
committed
benchmark: added initial benchmark tool
1 parent 1e275da commit 33e31e7

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

benchmark.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import pyb
2+
3+
import display
4+
from display.ssd1322 import SSD1322
5+
6+
7+
def send_buffer(disp, n=1000):
8+
disp.framebuf.fill(0)
9+
start = pyb.millis()
10+
11+
for i in range(n):
12+
disp.send_buffer()
13+
14+
return pyb.elapsed_millis(start)
15+
16+
17+
def text_screen(disp, n=1000):
18+
disp.framebuf.fill(0)
19+
start = pyb.millis()
20+
21+
for i in range(n):
22+
disp.framebuf.fill(0)
23+
24+
for y in range(64 // 8):
25+
disp.framebuf.text('BENCHMARK', 0, y*8, 0xF)
26+
27+
disp.send_buffer()
28+
29+
return pyb.elapsed_millis(start)
30+
31+
32+
def run_display_benchmark(disp=None):
33+
disp = display.create_spi_display(SSD1322, 256, 64)
34+
35+
t1 = send_buffer(disp)
36+
t2 = text_screen(disp)
37+
38+
print(t1, t2)
39+

0 commit comments

Comments
 (0)