Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Namespaces | Classes | Functions
sbl::profiling Namespace Reference

CPU load monitoring. More...

Namespaces

namespace  detail
 

Classes

class  AudioBudget
 
struct  CycleScope
 
struct  NamedSection
 
struct  SectionProfile
 

Functions

void dwt_init ()
 Initialize DWT cycle counter. Call once after clock configuration.
 
uint32_t cycles ()
 
int format_report (char *buf, size_t size, const AudioBudget &budget, const NamedSection *sections, size_t n)
 Format a profiling report into a buffer.
 
int format_tagged_report (char *buf, size_t size, const AudioBudget &budget, const NamedSection *sections, size_t n)
 Format profiling data as tagged output lines.
 
int format_tagged_histogram (char *buf, size_t size, const AudioBudget &budget)
 Format CPU load histogram as a tagged output line.
 

Detailed Description

CPU load monitoring.

DWT cycle counter and AudioBudget tracking for real-time audio:

Function Documentation

◆ cycles()

uint32_t sbl::profiling::cycles ( )
inline

Read current cycle count (free-running, wraps at 2^32). Unsigned subtraction handles wraparound correctly.

Definition at line 47 of file dwt.hpp.

References sbl::profiling::detail::DWT_CYCCNT.

Referenced by sbl::profiling::AudioBudget::on_block_end(), sbl::profiling::AudioBudget::on_block_start(), and sbl::profiling::CycleScope::~CycleScope().

Here is the caller graph for this function:

◆ dwt_init()

void sbl::profiling::dwt_init ( )
inline

◆ format_report()

int sbl::profiling::format_report ( char *  buf,
size_t  size,
const AudioBudget budget,
const NamedSection sections,
size_t  n 
)
inline

Format a profiling report into a buffer.

Parameters
bufOutput buffer
sizeBuffer size
budgetAudioBudget instance
sectionsArray of named section profiles
nNumber of sections
Returns
Number of characters written

Definition at line 55 of file report.hpp.

References sbl::profiling::AudioBudget::avg_load(), sbl::log::format(), sbl::profiling::AudioBudget::overruns(), and sbl::profiling::AudioBudget::peak_load().

Here is the call graph for this function:

◆ format_tagged_histogram()

int sbl::profiling::format_tagged_histogram ( char *  buf,
size_t  size,
const AudioBudget budget 
)
inline

Format CPU load histogram as a tagged output line.

Emits a single #HIST line with 11 bucket counts (10% each, last is >100%).

Returns
Number of characters written

Definition at line 143 of file report.hpp.

References sbl::log::format(), sbl::profiling::AudioBudget::hist_bucket(), and sbl::profiling::AudioBudget::hist_size().

Here is the call graph for this function:

◆ format_tagged_report()

int sbl::profiling::format_tagged_report ( char *  buf,
size_t  size,
const AudioBudget budget,
const NamedSection sections,
size_t  n 
)
inline

Format profiling data as tagged output lines.

Emits one #PROF summary line followed by one #PROF.<NAME> line per section. Section names are uppercased in the tag (e.g., "osc" → #PROF.OSC).

Returns
Number of characters written

Definition at line 107 of file report.hpp.

References sbl::profiling::AudioBudget::avg_load(), sbl::profiling::AudioBudget::count(), sbl::log::format(), sbl::profiling::AudioBudget::min_load(), sbl::profiling::AudioBudget::overruns(), and sbl::profiling::AudioBudget::peak_load().

Here is the call graph for this function: