Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
sbl::profiling::AudioBudget Class Reference

#include <audio_budget.hpp>

Collaboration diagram for sbl::profiling::AudioBudget:

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.
 

Detailed Description

Definition at line 39 of file audio_budget.hpp.

Member Function Documentation

◆ avg_cycles()

uint32_t sbl::profiling::AudioBudget::avg_cycles ( ) const
inline

Raw cycle counts.

Definition at line 112 of file audio_budget.hpp.

◆ avg_load()

float sbl::profiling::AudioBudget::avg_load ( ) const
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().

Here is the caller graph for this function:

◆ budget_cycles()

uint32_t sbl::profiling::AudioBudget::budget_cycles ( ) const
inline

Definition at line 136 of file audio_budget.hpp.

◆ count()

uint32_t sbl::profiling::AudioBudget::count ( ) const
inline

Total callbacks measured.

Definition at line 154 of file audio_budget.hpp.

Referenced by sbl::profiling::format_tagged_report().

Here is the caller graph for this function:

◆ hist_bucket()

uint32_t sbl::profiling::AudioBudget::hist_bucket ( size_t  i) const
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().

Here is the caller graph for this function:

◆ hist_size()

static constexpr size_t sbl::profiling::AudioBudget::hist_size ( )
inlinestaticconstexpr

Number of histogram buckets.

Definition at line 165 of file audio_budget.hpp.

Referenced by sbl::profiling::format_tagged_histogram().

Here is the caller graph for this function:

◆ init()

void sbl::profiling::AudioBudget::init ( uint32_t  sample_rate,
uint16_t  block_size,
uint32_t  cpu_hz 
)
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().

Here is the call graph for this function:

◆ min_cycles()

uint32_t sbl::profiling::AudioBudget::min_cycles ( ) const
inline

Definition at line 128 of file audio_budget.hpp.

◆ min_load()

float sbl::profiling::AudioBudget::min_load ( ) const
inline

Minimum CPU load since last reset.

Definition at line 103 of file audio_budget.hpp.

Referenced by sbl::profiling::format_tagged_report().

Here is the caller graph for this function:

◆ on_block_end()

void sbl::profiling::AudioBudget::on_block_end ( )
inline

Mark the end of audio processing (call last in callback)

Definition at line 62 of file audio_budget.hpp.

References sbl::profiling::cycles().

Here is the call graph for this function:

◆ on_block_start()

void sbl::profiling::AudioBudget::on_block_start ( )
inline

Mark the start of audio processing (call first in callback)

Definition at line 55 of file audio_budget.hpp.

References sbl::profiling::cycles().

Here is the call graph for this function:

◆ overruns()

uint32_t sbl::profiling::AudioBudget::overruns ( ) const
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().

Here is the caller graph for this function:

◆ peak_cycles()

uint32_t sbl::profiling::AudioBudget::peak_cycles ( ) const
inline

Definition at line 120 of file audio_budget.hpp.

◆ peak_load()

float sbl::profiling::AudioBudget::peak_load ( ) const
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().

Here is the caller graph for this function:

◆ reset()

void sbl::profiling::AudioBudget::reset ( )
inline

Reset statistics (budget preserved)

Definition at line 177 of file audio_budget.hpp.

Referenced by init().

Here is the caller graph for this function:

The documentation for this class was generated from the following file: