Skip to content

Commit 5368641

Browse files
committed
* refactor timeval macos test for better precision; use the correct timeval::tv_usec size
* allow de-nicing macos bounce tests and kitty term if present * tweak sleep times in bounce macos tests
1 parent c4db37b commit 5368641

8 files changed

+153
-56
lines changed

test_macos/test_bounce.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ fb_cursor_len = . - fb_cursor_cmd
121121

122122
.align 3
123123
timeval:
124-
.dword 0, 13000
124+
.dword 0, 12300
125125

126126
.section .bss
127127
.align 6

test_macos/test_bounce.sh

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,40 @@ BUILD=..
33

44
make -C ${BUILD} all
55

6+
# De-nice ourselves and our kitty term emu for smooth fps; some root required
7+
8+
DENICE=
9+
PID_KITTY=
10+
11+
if [[ $# == 1 ]] && [[ $1 == "denice" ]] ; then
12+
13+
DENICE="sudo nice -n -20"
14+
15+
# Check if terminal is kitty -- normally our terminal should be our grandpatent
16+
17+
PID_KITTY=`ps -p $PPID -o ppid=''`
18+
COMM_KITTY=`ps -p $PID_KITTY -o command='' -c`
19+
20+
if [[ ${COMM_KITTY} != "kitty" ]] ; then
21+
PID_KITTY=
22+
fi
23+
fi
24+
25+
# Boost kitty to top warp
26+
27+
if [[ ! -z ${PID_KITTY} ]] ; then
28+
sudo renice -n -20 -p ${PID_KITTY}
29+
fi
30+
631
# Hide term cursor before loading REL; restore term cursor
732
# upon termination
833

934
tput civis
10-
${BUILD}/elvenrel test_bounce.o
35+
${DENICE} ${BUILD}/elvenrel test_bounce.o
1136
tput cnorm
37+
38+
# De-boost kitty to normal warp
39+
40+
if [[ ! -z ${PID_KITTY} ]] ; then
41+
sudo renice -n 20 -p ${PID_KITTY}
42+
fi

test_macos/test_bounce_neon.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ fb_cursor_len = . - fb_cursor_cmd
152152

153153
.align 3
154154
timeval:
155-
.dword 0, 13000
155+
.dword 0, 12300
156156

157157
.section .bss
158158
.align 6

test_macos/test_bounce_neon.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
#!/bin/bash
2+
BUILD=..
3+
4+
make -C ${BUILD} all
5+
6+
# De-nice ourselves and our kitty term emu for smooth fps; some root required
7+
8+
DENICE=
9+
PID_KITTY=
10+
11+
if [[ $# == 1 ]] && [[ $1 == "denice" ]] ; then
12+
13+
DENICE="sudo nice -n -20"
14+
15+
# Check if terminal is kitty -- normally our terminal should be our grandpatent
16+
17+
PID_KITTY=`ps -p $PPID -o ppid=''`
18+
COMM_KITTY=`ps -p $PID_KITTY -o command='' -c`
19+
20+
if [[ ${COMM_KITTY} != "kitty" ]] ; then
21+
PID_KITTY=
22+
fi
23+
fi
24+
25+
# Boost kitty to top warp
26+
27+
if [[ ! -z ${PID_KITTY} ]] ; then
28+
sudo renice -n -20 -p ${PID_KITTY}
29+
fi
30+
31+
# Hide term cursor before loading REL; restore term cursor
32+
# upon termination
33+
34+
tput civis
35+
${DENICE} ${BUILD}/elvenrel test_bounce_neon.o
36+
tput cnorm
37+
38+
# De-boost kitty to normal warp
39+
40+
if [[ ! -z ${PID_KITTY} ]] ; then
41+
sudo renice -n 20 -p ${PID_KITTY}
42+
fi

test_macos/test_bounce_neon_aosoa.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ fb_cursor_len = . - fb_cursor_cmd
164164

165165
.align 3
166166
timeval:
167-
.dword 0, 13000
167+
.dword 0, 12300
168168

169169
.section .bss
170170
.align 6

test_macos/test_bounce_neon_aosoa.sh

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,44 @@ COMMON=../test_common
44

55
make -C ${BUILD} all
66

7+
# De-nice ourselves and our kitty term emu for smooth fps; some root required
8+
9+
DENICE=
10+
PID_KITTY=
11+
12+
if [[ $# == 1 ]] && [[ $1 == "denice" ]] ; then
13+
14+
DENICE="sudo nice -n -20"
15+
16+
# Check if terminal is kitty -- normally our terminal should be our grandpatent
17+
18+
PID_KITTY=`ps -p $PPID -o ppid=''`
19+
COMM_KITTY=`ps -p $PID_KITTY -o command='' -c`
20+
21+
if [[ ${COMM_KITTY} != "kitty" ]] ; then
22+
PID_KITTY=
23+
fi
24+
fi
25+
26+
# Boost kitty to top warp
27+
28+
if [[ ! -z ${PID_KITTY} ]] ; then
29+
sudo renice -n -20 -p ${PID_KITTY}
30+
fi
31+
732
# Hide term cursor before loading RELs; suppress reports to
833
# stdout; restore term cursor upon termination
934

1035
tput civis
11-
${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_0.o test_bounce_neon_aosoa.o --quiet
12-
${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_1.o test_bounce_neon_aosoa.o --quiet
13-
${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_2.o test_bounce_neon_aosoa.o --quiet
14-
${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_3.o test_bounce_neon_aosoa.o --quiet
15-
${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_2.o test_bounce_neon_aosoa_bg.o --quiet
36+
${DENICE} ${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_0.o test_bounce_neon_aosoa.o --quiet
37+
${DENICE} ${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_1.o test_bounce_neon_aosoa.o --quiet
38+
${DENICE} ${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_2.o test_bounce_neon_aosoa.o --quiet
39+
${DENICE} ${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_3.o test_bounce_neon_aosoa.o --quiet
40+
${DENICE} ${BUILD}/elvenrel ${COMMON}/test_bounce_data_aosoa_alt_2.o test_bounce_neon_aosoa_bg.o --quiet
1641
tput cnorm
42+
43+
# De-boost kitty to normal warp
44+
45+
if [[ ! -z ${PID_KITTY} ]] ; then
46+
sudo renice -n 20 -p ${PID_KITTY}
47+
fi

test_macos/test_bounce_neon_aosoa_bg.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ fb_cursor_len = . - fb_cursor_cmd
364364

365365
.align 3
366366
timeval:
367-
.dword 0, 13000
367+
.dword 0, 12300
368368

369369
.section .bss
370370
.align 6

test_macos/test_timeval.s

Lines changed: 39 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -35,61 +35,32 @@ advance_timeval_us:
3535
subs w2, w4, w2
3636
blo .Lupdate_only_us
3737
add x3, x3, 1
38-
stp x3, x2, [x0]
38+
str x3, [x0]
39+
str w2, [x0, 8]
3940
ret
4041
.Lupdate_only_us:
4142
add w4, w4, w1
42-
str x4, [x0, 8]
43+
str w4, [x0, 8]
4344
ret
4445

4546
_start:
4647
adrf x17, timeval
48+
adrf x18, msg
4749

4850
mov x16, SYS_gettimeofday
4951
mov x2, xzr
5052
mov x1, xzr
5153
mov x0, x17
5254
svc 0
5355

54-
// itoa timeval::tv_sec
55-
ldr x1, [x17]
56-
adrf x0, msg
57-
bl string_x64
58-
59-
// itoa timeval::tv_usec
60-
ldr x1, [x17, 8]
61-
adrf x0, msg + 17
62-
bl string_x64
63-
64-
// output current time
65-
mov x16, SYS_write
66-
mov x2, msg_len
67-
adrf x1, msg
68-
mov x0, STDOUT_FILENO
69-
svc 0
56+
ldr q0, [x17]
57+
str q0, [x17, 16]
7058

7159
// advance time by DTIME us
7260
mov w1, DTIME
73-
mov x0, x17
61+
add x0, x17, 16
7462
bl advance_timeval_us
7563

76-
// itoa timeval::tv_sec
77-
ldr x1, [x17]
78-
adrf x0, msg
79-
bl string_x64
80-
81-
// itoa timeval::tv_usec
82-
ldr x1, [x17, 8]
83-
adrf x0, msg + 17
84-
bl string_x64
85-
86-
// output new time
87-
mov x16, SYS_write
88-
mov x2, msg_len
89-
adrf x1, msg
90-
mov x0, STDOUT_FILENO
91-
svc 0
92-
9364
// xnu has no nano/usleep -- use select with empty fd sets
9465
mov x16, SYS_select
9566
adr x4, timeval_select
@@ -102,23 +73,40 @@ _start:
10273
mov x16, SYS_gettimeofday
10374
mov x2, xzr
10475
mov x1, xzr
105-
mov x0, x17
76+
add x0, x17, 32
10677
svc 0
10778

108-
// itoa timeval::tv_sec
109-
ldr x1, [x17]
110-
adrf x0, msg
79+
// itoa start time (timeval::tv_sec and timeval::tv_usec)
80+
ldr x1, [x17], 8
81+
mov x0, x18
11182
bl string_x64
11283

113-
// itoa timeval::tv_usec
114-
ldr x1, [x17, 8]
115-
adrf x0, msg + 17
84+
ldr w1, [x17], 8
85+
add x0, x18, 17
86+
bl string_x32
87+
88+
// itoa target time
89+
ldr x1, [x17], 8
90+
add x0, x18, 26
11691
bl string_x64
11792

118-
// output post-sleep time
93+
ldr w1, [x17], 8
94+
add x0, x18, 43
95+
bl string_x32
96+
97+
// itoa post-sleep time
98+
ldr x1, [x17], 8
99+
add x0, x18, 52
100+
bl string_x64
101+
102+
ldr w1, [x17], 8
103+
add x0, x18, 69
104+
bl string_x32
105+
106+
// output start, target and post-sleep times
119107
mov x16, SYS_write
120108
mov x2, msg_len
121-
adrf x1, msg
109+
mov x1, x18
122110
mov x0, STDOUT_FILENO
123111
svc 0
124112

@@ -130,10 +118,15 @@ timeval_select:
130118
.dword 0, DTIME
131119

132120
.section .bss
121+
.align 4
133122
timeval:
134123
.dword 0, 0
124+
.dword 0, 0
125+
.dword 0, 0
135126

136127
.section .data
137128
msg:
138-
.ascii "################:################\n"
129+
.ascii "################:########\n"
130+
.ascii "################:########\n"
131+
.ascii "################:########\n"
139132
msg_len = . - msg

0 commit comments

Comments
 (0)