Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add benchmark tool and doc #147

Merged
merged 5 commits into from
Mar 23, 2023
Merged

add benchmark tool and doc #147

merged 5 commits into from
Mar 23, 2023

Conversation

barbibulle
Copy link
Collaborator

This is a "swiss army knife" benchmarking tool that can be used to test the throughput and/or latency between two devices.
Supported modes:

  • GATT
  • L2CAP CoC
  • RFComm

Supported roles:

  • Server (sends data as fast as possible)
  • Receiver (receives data from a Server role and sends back a final ACK when the server is done sending)
  • Ping (sends periodic PINGs)
  • Ping (responds to PINGs)

One device runs as the Central (with the ability to specify a custom Connection Interval and PHY), the other as the Peripheral.
The modes are independent of the roles and of the central/peripheral choice. So, for example, you can have a Central be a Sender as a GATT client (default), and the Peripheral be the Receiver as a GATT server. But you could also have the Central be a Receiver as a GATT client, or a Sender as a GATT server, etc.

apps/bench.py Outdated
self.expected_packet_index = packet_index + 1

if packet_flags & PACKET_FLAG_LAST:
asyncio.create_task(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of python/cpython#88831, I suggest to push the packet to a queue and to loop get/send in // of self.done.wait() in async def run(self) bellow

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! I wasn't aware of that. I have to go and check that we don't have this potential issue elsewhere in the code base.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit.

Copy link
Contributor

@uael uael Mar 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just thought about that but we can call it spawn instead of run?
Edit: not this one, I mean the new one in AsyncRunner

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point, spawn is a better name for it.

apps/bench.py Outdated Show resolved Hide resolved
apps/bench.py Outdated Show resolved Hide resolved
bumble/device.py Outdated Show resolved Hide resolved
docs/mkdocs/src/apps_and_tools/bench.md Outdated Show resolved Hide resolved
@uael
Copy link
Contributor

uael commented Mar 21, 2023

LGTM 👍

@barbibulle barbibulle merged commit 6e719ca into main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants