kopia lustrzana https://github.com/micropython/micropython-lib
aioble/multitests: Use multitest.output_metric for perf results.
The perf multitests now "pass" when run. Signed-off-by: Damien George <damien@micropython.org>pull/863/head
rodzic
1e792c39d3
commit
2c30a4e91b
|
@ -47,6 +47,8 @@ async def instance0_task():
|
||||||
20_000, adv_data=b"\x02\x01\x06\x04\xffMPY", timeout_ms=TIMEOUT_MS
|
20_000, adv_data=b"\x02\x01\x06\x04\xffMPY", timeout_ms=TIMEOUT_MS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print("connect")
|
||||||
|
|
||||||
client_characteristic = await discover_server(connection)
|
client_characteristic = await discover_server(connection)
|
||||||
|
|
||||||
# Give the central enough time to discover chars.
|
# Give the central enough time to discover chars.
|
||||||
|
@ -61,7 +63,7 @@ async def instance0_task():
|
||||||
|
|
||||||
ticks_end = time.ticks_ms()
|
ticks_end = time.ticks_ms()
|
||||||
ticks_total = time.ticks_diff(ticks_end, ticks_start)
|
ticks_total = time.ticks_diff(ticks_end, ticks_start)
|
||||||
print(
|
multitest.output_metric(
|
||||||
"Acknowledged {} notifications in {} ms. {} ms/notification.".format(
|
"Acknowledged {} notifications in {} ms. {} ms/notification.".format(
|
||||||
_NUM_NOTIFICATIONS, ticks_total, ticks_total // _NUM_NOTIFICATIONS
|
_NUM_NOTIFICATIONS, ticks_total, ticks_total // _NUM_NOTIFICATIONS
|
||||||
)
|
)
|
||||||
|
@ -87,6 +89,8 @@ async def instance1_task():
|
||||||
device = aioble.Device(*BDADDR)
|
device = aioble.Device(*BDADDR)
|
||||||
connection = await device.connect(timeout_ms=TIMEOUT_MS)
|
connection = await device.connect(timeout_ms=TIMEOUT_MS)
|
||||||
|
|
||||||
|
print("connect")
|
||||||
|
|
||||||
client_characteristic = await discover_server(connection)
|
client_characteristic = await discover_server(connection)
|
||||||
|
|
||||||
for i in range(_NUM_NOTIFICATIONS):
|
for i in range(_NUM_NOTIFICATIONS):
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
--- instance0 ---
|
||||||
|
connect
|
||||||
|
--- instance1 ---
|
||||||
|
connect
|
|
@ -32,6 +32,8 @@ async def instance0_task():
|
||||||
20_000, adv_data=b"\x02\x01\x06\x04\xffMPY", timeout_ms=TIMEOUT_MS
|
20_000, adv_data=b"\x02\x01\x06\x04\xffMPY", timeout_ms=TIMEOUT_MS
|
||||||
)
|
)
|
||||||
|
|
||||||
|
print("connect")
|
||||||
|
|
||||||
channel = await connection.l2cap_accept(_L2CAP_PSM, _L2CAP_MTU, timeout_ms=TIMEOUT_MS)
|
channel = await connection.l2cap_accept(_L2CAP_PSM, _L2CAP_MTU, timeout_ms=TIMEOUT_MS)
|
||||||
|
|
||||||
random.seed(_RANDOM_SEED)
|
random.seed(_RANDOM_SEED)
|
||||||
|
@ -66,6 +68,8 @@ async def instance1_task():
|
||||||
device = aioble.Device(*BDADDR)
|
device = aioble.Device(*BDADDR)
|
||||||
connection = await device.connect(timeout_ms=TIMEOUT_MS)
|
connection = await device.connect(timeout_ms=TIMEOUT_MS)
|
||||||
|
|
||||||
|
print("connect")
|
||||||
|
|
||||||
await asyncio.sleep_ms(500)
|
await asyncio.sleep_ms(500)
|
||||||
|
|
||||||
channel = await connection.l2cap_connect(_L2CAP_PSM, _L2CAP_MTU, timeout_ms=TIMEOUT_MS)
|
channel = await connection.l2cap_connect(_L2CAP_PSM, _L2CAP_MTU, timeout_ms=TIMEOUT_MS)
|
||||||
|
@ -90,7 +94,7 @@ async def instance1_task():
|
||||||
ticks_end = time.ticks_ms()
|
ticks_end = time.ticks_ms()
|
||||||
total_ticks = time.ticks_diff(ticks_end, ticks_first_byte)
|
total_ticks = time.ticks_diff(ticks_end, ticks_first_byte)
|
||||||
|
|
||||||
print(
|
multitest.output_metric(
|
||||||
"Received {}/{} bytes in {} ms. {} B/s".format(
|
"Received {}/{} bytes in {} ms. {} B/s".format(
|
||||||
recv_bytes, recv_correct, total_ticks, recv_bytes * 1000 // total_ticks
|
recv_bytes, recv_correct, total_ticks, recv_bytes * 1000 // total_ticks
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
--- instance0 ---
|
||||||
|
connect
|
||||||
|
--- instance1 ---
|
||||||
|
connect
|
Ładowanie…
Reference in New Issue