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

host-sp-comms: add event counters #1638

Merged
merged 5 commits into from
Mar 13, 2024
Merged

host-sp-comms: add event counters #1638

merged 5 commits into from
Mar 13, 2024

Conversation

hawkw
Copy link
Member

@hawkw hawkw commented Feb 28, 2024

This branch adds event counters to host-sp-comms's existing 20-element ringbuffer, so that the total number of events can be tracked. In particular, we count the total number of each message variant messages sent and received between the host and SP, and each variant of the KeyLookupResult, KeySetResult, and InventoryResult messages.

Depends on #1635.

Currently, the `armv6m-atomic-hack` crate is, to use a technical term,
*annoying*. Its extension traits only exist when `#[cfg(armv6m)]` is
set. This means that, in downstream crates that wish to _use_
`armv6m-atomic-hack` to support v6m targets, the extension traits may
only be imported when `#[cfg(armv6m)]` is set. Because `RUSTFLAGS` cfgs
don't propagate across dependency boundaries, this means that _each_
dependent of `armv6m-atomic-hack` must add a build script with a call to
`build_utils::expose_m_profile()` so that the cfg is set properly when
building for a v6m board. This is, as previously stated, annoying ---
especially when using crates like `counters`, whose `#[derive(Count)]`
attribute expands to a use of `AtomicU32Ext`, and thus requires any
crate that derives `Count` to add a build script.

This branch changes `armv6m-atomic-hack` so that the extension traits
`AtomicU32Ext` and `AtomicBoolExt` are always defined, regardless of
whether `#[cfg(armv6m)]` is set. Now, only the *implementation* of those
traits differs based on the presence of the `armv6m` cfg --- if it is
not set, an implementation is provided that simply forwards to the
corresponding methods on the `AtomicU32` and `AtomicBool` types in
libcore. This way, dependents of `armv6m-atomic-hack` can just import
the extension traits without needing to add a build script with
`expose_m_profile()`; now, only `armv6m-atomic-hack` itself needs the
build script. Now, the `armv6m-atomic-hack` crate can no longer be
considered annoying.
This branch adds event counters to `host-sp-comms`'s existing 20-element
ringbuffer, so that the total number of events can be tracked. In
particular, we count the total number of each message variant messages
sent and received between the host and SP, and each variant of the
`KeyLookupResult`, `KeySetResult`, and `InventoryResult` messages.

Depends on #1635.
Base automatically changed from eliza/less-annoying-atomic-hack to master February 29, 2024 00:15
@hawkw hawkw marked this pull request as ready for review February 29, 2024 00:15
@hawkw hawkw merged commit 05a1df7 into master Mar 13, 2024
83 checks passed
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.

2 participants