Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
section.hpp File Reference

Per-section cycle profiling: a running average and a window's extremes. More...

Detailed Description

Per-section cycle profiling: a running average and a window's extremes.

Measures the cycles a named stretch of code takes each pass: a running average (EWMA, alpha 1/128), and the smallest and the largest pass of the window. A registered section is an entry of the registry (registry.hpp), which closes its windows; one that is not registered restarts its extremes with reset_window().

Gated behind SBL_PROFILING_ENABLED. Without it the class is empty, its methods compile to nothing and the macros expand to nothing.

Usage:

// At startup:
prof_osc.register_as("osc");
prof_svf.register_as("svf");
void audio_callback(...) {
// ... oscillator rendering ...
SBL_PROF_SECTION(prof_osc, t);
// ... filter processing ...
SBL_PROF_SECTION(prof_svf, t);
}
#define SBL_PROF_MARK(var)
Definition section.hpp:95
#define SBL_PROF_SECTION(section, start)
Definition section.hpp:107

Definition in file section.hpp.

#include <cmath>
#include <cstdint>
#include <sbl/system/profiling/registry.hpp>

Go to the source code of this file.

Classes

class  sbl::system::profiling::SectionProfile
 

Namespaces

namespace  sbl
 Root namespace for all Sound Byte Libs code.
 
namespace  sbl::system
 The system layer: execution levels, the control critical section, ring buffers, assertions and the fault handler, profiling, and the port contracts.
 
namespace  sbl::system::profiling
 Profiling: the cycle counter, the audio budget, section profiles and reports.
 

Macros

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

Macro Definition Documentation

◆ SBL_PROF_MARK

#define SBL_PROF_MARK (   var)    (void)0

Mark a timestamp variable for section profiling

Definition at line 95 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 107 of file section.hpp.