chore: add benchmark for interfaces added message (#432)
This commit is contained in:
parent
c319916a01
commit
1988984398
@ -99,3 +99,31 @@ def test_unmarshall_multiple_bluez_properties_message_socket(
|
|||||||
|
|
||||||
sock1.close()
|
sock1.close()
|
||||||
sock2.close()
|
sock2.close()
|
||||||
|
|
||||||
|
|
||||||
|
def test_unmarshall_bluez_interfaces_added_message(benchmark: BenchmarkFixture) -> None:
|
||||||
|
bluez_interfaces_added_message = (
|
||||||
|
b'l\4\1\1\240\2\0\0\227\272\23\0u\0\0\0\1\1o\0\1\0\0\0/\0\0\0\0\0\0\0\2\1s\0"\0\0\0'
|
||||||
|
b"org.freedesktop.DBus.ObjectManager\0\0\0\0\0\0\3\1s\0\17\0\0\0InterfacesAdded\0\10"
|
||||||
|
b"\1g\0\noa{sa{sv}}\0\7\1s\0\4\0\0\0:1.4\0\0\0\0%\0\0\0/org/bluez/hci1/dev_58_2D_34"
|
||||||
|
b"_60_26_36\0\0\0p\2\0\0#\0\0\0org.freedesktop.DBus.Introspectable\0\0\0\0\0\0\0\0\0"
|
||||||
|
b"\21\0\0\0org.bluez.Device1\0\0\0\364\1\0\0\0\0\0\0\7\0\0\0Address\0\1s\0\0\21\0\0"
|
||||||
|
b"\00058:2D:34:60:26:36\0\0\0\v\0\0\0AddressType\0\1s\0\0\6\0\0\0public\0\0\4\0\0\0"
|
||||||
|
b"Name\0\1s\0\33\0\0\0Qingping Door/Window Sensor\0\0\0\0\0\5\0\0\0Alias\0\1s\0\0\0"
|
||||||
|
b"\0\33\0\0\0Qingping Door/Window Sensor\0\6\0\0\0Paired\0\1b\0\0\0\0\0\0\0\0\0\0\0"
|
||||||
|
b"\7\0\0\0Trusted\0\1b\0\0\0\0\0\0\0\0\0\0\7\0\0\0Blocked\0\1b\0\0\0\0\0\0\0\0\0\0\r"
|
||||||
|
b"\0\0\0LegacyPairing\0\1b\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0RSSI\0\1n\0\316\377\0\0\t"
|
||||||
|
b"\0\0\0Connected\0\1b\0\0\0\0\0\0\0\0\5\0\0\0UUIDs\0\2as\0\0\0\0\0\0\0\0\0\0\0\7\0"
|
||||||
|
b"\0\0Adapter\0\1o\0\0\17\0\0\0/org/bluez/hci1\0\0\0\0\0\v\0\0\0ServiceData\0\5a{sv}"
|
||||||
|
b"\0\0@\0\0\0\0\0\0\0$\0\0\0000000fe95-0000-1000-8000-00805f9b34fb\0\2ay\0\0\0\0\f\0"
|
||||||
|
b"\0\0000X\326\3\0026&`4-X\10\20\0\0\0ServicesResolved\0\1b\0\0\0\0\0\0\0\0\0\37\0\0"
|
||||||
|
b"\0org.freedesktop.DBus.Properties\0\0\0\0\0"
|
||||||
|
)
|
||||||
|
stream = io.BytesIO(bluez_interfaces_added_message)
|
||||||
|
|
||||||
|
unmarshaller = Unmarshaller(stream)
|
||||||
|
|
||||||
|
@benchmark
|
||||||
|
def unmarshall():
|
||||||
|
stream.seek(0)
|
||||||
|
unmarshaller.unmarshall()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user