Skip to content

Commit 2c30a4e

Browse files
committed
aioble/multitests: Use multitest.output_metric for perf results.
The perf multitests now "pass" when run. Signed-off-by: Damien George <[email protected]>
1 parent 1e792c3 commit 2c30a4e

File tree

4 files changed

+18
-2
lines changed

4 files changed

+18
-2
lines changed

Diff for: micropython/bluetooth/aioble/multitests/perf_gatt_notify.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ async def instance0_task():
4747
20_000, adv_data=b"\x02\x01\x06\x04\xffMPY", timeout_ms=TIMEOUT_MS
4848
)
4949

50+
print("connect")
51+
5052
client_characteristic = await discover_server(connection)
5153

5254
# Give the central enough time to discover chars.
@@ -61,7 +63,7 @@ async def instance0_task():
6163

6264
ticks_end = time.ticks_ms()
6365
ticks_total = time.ticks_diff(ticks_end, ticks_start)
64-
print(
66+
multitest.output_metric(
6567
"Acknowledged {} notifications in {} ms. {} ms/notification.".format(
6668
_NUM_NOTIFICATIONS, ticks_total, ticks_total // _NUM_NOTIFICATIONS
6769
)
@@ -87,6 +89,8 @@ async def instance1_task():
8789
device = aioble.Device(*BDADDR)
8890
connection = await device.connect(timeout_ms=TIMEOUT_MS)
8991

92+
print("connect")
93+
9094
client_characteristic = await discover_server(connection)
9195

9296
for i in range(_NUM_NOTIFICATIONS):
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--- instance0 ---
2+
connect
3+
--- instance1 ---
4+
connect

Diff for: micropython/bluetooth/aioble/multitests/perf_l2cap.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ async def instance0_task():
3232
20_000, adv_data=b"\x02\x01\x06\x04\xffMPY", timeout_ms=TIMEOUT_MS
3333
)
3434

35+
print("connect")
36+
3537
channel = await connection.l2cap_accept(_L2CAP_PSM, _L2CAP_MTU, timeout_ms=TIMEOUT_MS)
3638

3739
random.seed(_RANDOM_SEED)
@@ -66,6 +68,8 @@ async def instance1_task():
6668
device = aioble.Device(*BDADDR)
6769
connection = await device.connect(timeout_ms=TIMEOUT_MS)
6870

71+
print("connect")
72+
6973
await asyncio.sleep_ms(500)
7074

7175
channel = await connection.l2cap_connect(_L2CAP_PSM, _L2CAP_MTU, timeout_ms=TIMEOUT_MS)
@@ -90,7 +94,7 @@ async def instance1_task():
9094
ticks_end = time.ticks_ms()
9195
total_ticks = time.ticks_diff(ticks_end, ticks_first_byte)
9296

93-
print(
97+
multitest.output_metric(
9498
"Received {}/{} bytes in {} ms. {} B/s".format(
9599
recv_bytes, recv_correct, total_ticks, recv_bytes * 1000 // total_ticks
96100
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--- instance0 ---
2+
connect
3+
--- instance1 ---
4+
connect

0 commit comments

Comments
 (0)