commit | 3f8b108f71240039f73c642e3e8cf908293fd4fc | [log] [tgz] |
---|---|---|
author | Aaron Green <aarongreen@google.com> | Fri Mar 08 04:26:14 2024 +0000 |
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | Fri Mar 08 04:26:14 2024 +0000 |
tree | 62a1f93827e4003545c9386cb3e85d2334a874ef | |
parent | 01f704a974aa98c31b1ee2c61bf73396c4aa8e49 [diff] |
pw_allocator: Make metrics configurable Previously, metrics in pw_allocator have been controlled by one big switch: the pw_allocator_COLLECT_METRICS build argument. This approach has proven to be too inflexible and coarse grained for downstream consumers. This CL instead uses preprocessor directives, including a definition for PW_ALLOCATOR_METRICS_ENABLE. Downstream consumers can use this to define metrics structs that selectively enable specific metrics and pass these to TrackingAllocator. The TrackingAllocator class now includes an internal::Metrics, templated on the same metrics struct. This object guards each access to a metric with a constexpr-if condition, allowing the relevant code to be omitted when the metric is not enabled. Bug: b/326509341 Change-Id: Ib541eede9563b00ceebbf1d45c43726ebf44569c Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/193621 Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keir Mierle <keir@google.com> Commit-Queue: Aaron Green <aarongreen@google.com>
Pigweed is an open source collection of embedded-targeted libraries–or as we like to call them, modules. These modules are building blocks and infrastructure that enable faster and more reliable development on small-footprint MMU-less 32-bit microcontrollers like the STMicroelectronics STM32L452 or the Nordic nRF52832.
For more information please see our website: https://pigweed.dev/.