|
Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
#include <audio_budget.hpp>
Public Member Functions | |
| void | init (uint32_t sample_rate, uint16_t block_size, uint32_t cpu_hz) |
| void | on_block_start () |
| Mark the start of audio processing (call first in callback) | |
| void | on_block_end () |
| Mark the end of audio processing (call last in callback) | |
| float | avg_load () const |
| Average CPU load as fraction [0.0, 1.0+]. | |
| float | peak_load () const |
| Peak (worst-case) CPU load since last reset. | |
| float | min_load () const |
| Minimum CPU load since last reset. | |
| uint32_t | avg_cycles () const |
| Raw cycle counts. | |
| uint32_t | peak_cycles () const |
| uint32_t | min_cycles () const |
| uint32_t | budget_cycles () const |
| uint32_t | overruns () const |
| Number of callbacks that exceeded the cycle budget. | |
| uint32_t | count () const |
| Total callbacks measured. | |
| uint32_t | hist_bucket (size_t i) const |
| Read histogram bucket count (0-indexed, last bucket is >100%) | |
| void | reset () |
| Reset statistics (budget preserved) | |
Static Public Member Functions | |
| static constexpr size_t | hist_size () |
| Number of histogram buckets. | |
Definition at line 39 of file audio_budget.hpp.
|
inline |
Raw cycle counts.
Definition at line 112 of file audio_budget.hpp.
|
inline |
Average CPU load as fraction [0.0, 1.0+].
Definition at line 85 of file audio_budget.hpp.
Referenced by sbl::profiling::format_report(), and sbl::profiling::format_tagged_report().
|
inline |
Definition at line 136 of file audio_budget.hpp.
|
inline |
Total callbacks measured.
Definition at line 154 of file audio_budget.hpp.
Referenced by sbl::profiling::format_tagged_report().
|
inline |
Read histogram bucket count (0-indexed, last bucket is >100%)
Definition at line 168 of file audio_budget.hpp.
Referenced by sbl::profiling::format_tagged_histogram().
|
inlinestaticconstexpr |
Number of histogram buckets.
Definition at line 165 of file audio_budget.hpp.
Referenced by sbl::profiling::format_tagged_histogram().
|
inline |
Configure budget from audio parameters. budget_cycles = (cpu_hz / sample_rate) * block_size
Definition at line 45 of file audio_budget.hpp.
References reset().
|
inline |
Definition at line 128 of file audio_budget.hpp.
|
inline |
Minimum CPU load since last reset.
Definition at line 103 of file audio_budget.hpp.
Referenced by sbl::profiling::format_tagged_report().
|
inline |
Mark the end of audio processing (call last in callback)
Definition at line 62 of file audio_budget.hpp.
References sbl::profiling::cycles().
|
inline |
Mark the start of audio processing (call first in callback)
Definition at line 55 of file audio_budget.hpp.
References sbl::profiling::cycles().
|
inline |
Number of callbacks that exceeded the cycle budget.
Definition at line 145 of file audio_budget.hpp.
Referenced by sbl::profiling::format_report(), and sbl::profiling::format_tagged_report().
|
inline |
Definition at line 120 of file audio_budget.hpp.
|
inline |
Peak (worst-case) CPU load since last reset.
Definition at line 94 of file audio_budget.hpp.
Referenced by sbl::profiling::format_report(), and sbl::profiling::format_tagged_report().
|
inline |
Reset statistics (budget preserved)
Definition at line 177 of file audio_budget.hpp.
Referenced by init().