Sound Byte Libs 29c5ff3
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Classes | Namespaces | Macros
section.hpp File Reference

Per-section cycle profiling with EWMA smoothing. More...

#include <cstdint>
Include dependency graph for section.hpp:

Go to the source code of this file.

Classes

struct  sbl::profiling::SectionProfile
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs functionality.
 
namespace  sbl::profiling
 CPU load monitoring.
 

Macros

#define SBL_PROF_MARK(var)   (void)0
 Mark a timestamp variable for section profiling.
 
#define SBL_PROF_SECTION(section, start)   (void)0
 Measure cycles since 'start', update section profile, advance start.
 

Detailed Description

Per-section cycle profiling with EWMA smoothing.

Measures CPU cycles consumed by named code sections in audio callbacks. Uses integer EWMA (alpha = 1/128, shift-based) for low-overhead smoothing.

Gated behind SBL_PROFILING_ENABLED. When disabled, SectionProfile::avg is a static constexpr zero so format strings compile without #ifdef.

Usage: static sbl::profiling::SectionProfile s_prof_osc; static sbl::profiling::SectionProfile s_prof_svf;

void audio_callback(...) { SBL_PROF_MARK(t); // ... oscillator rendering ... SBL_PROF_SECTION(s_prof_osc, t); // ... filter processing ... SBL_PROF_SECTION(s_prof_svf, t); }

Definition in file section.hpp.

Macro Definition Documentation

◆ SBL_PROF_MARK

#define SBL_PROF_MARK (   var)    (void)0

Mark a timestamp variable for section profiling.

Definition at line 58 of file section.hpp.

◆ SBL_PROF_SECTION

#define SBL_PROF_SECTION (   section,
  start 
)    (void)0

Measure cycles since 'start', update section profile, advance start.

Definition at line 69 of file section.hpp.