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
registry.hpp File Reference

The profiling registry: every budget, section and counter in one table. More...

Detailed Description

The profiling registry: every budget, section and counter in one table.

An AudioBudget, a SectionProfile or a Counter that registers by name keeps its statistics in an entry of one static table, behind a header, at the symbol sbl_profiling_registry. The reporter (report.hpp) walks the table, so an app does not list what it measures, and a tool that reads memory over SWD needs that one symbol and the layout documented on Registry. No allocation: the table holds SBL_PROFILING_REGISTRY_CAPACITY entries, and a registration past the capacity fails.

Gated behind SBL_PROFILING_ENABLED: without it there is no table and registration does nothing.

Usage:

// At startup, before the audio starts:
budget.init(48000, 48);
budget.register_as("audio");
osc.register_as("osc");
edges.register_as("edges");
Cycle budget of the audio callback: load, peak, minimum, overruns and a load histogram.
void init(uint32_t sample_rate, uint16_t block_size)
bool register_as(const char *name)

Definition in file registry.hpp.

#include <atomic>
#include <cstddef>
#include <cstdint>

Go to the source code of this file.

Classes

struct  sbl::system::profiling::Entry
 
struct  sbl::system::profiling::Registry
 The header and the table. More...
 

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_PROFILING_REGISTRY_CAPACITY   16
 

Enumerations

enum class  sbl::system::profiling::Kind : uint8_t { None = 0 , Budget = 1 , Section = 2 , Counter = 3 }
 

Variables

constexpr uint32_t sbl::system::profiling::REGISTRY_MAGIC = 0x464F5250u
 
constexpr uint32_t sbl::system::profiling::REGISTRY_VERSION = 1
 
constexpr size_t sbl::system::profiling::REGISTRY_CAPACITY = SBL_PROFILING_REGISTRY_CAPACITY
 
constexpr size_t sbl::system::profiling::NAME_SIZE = 12
 
constexpr uint32_t sbl::system::profiling::NO_MINIMUM = 0xFFFFFFFFu
 
constexpr uint32_t sbl::system::profiling::REGISTRY_HEADER_SIZE = 40
 
constexpr uint32_t sbl::system::profiling::REGISTRY_ENTRY_SIZE = 64
 

Macro Definition Documentation

◆ SBL_PROFILING_REGISTRY_CAPACITY

#define SBL_PROFILING_REGISTRY_CAPACITY   16

Entries the registry's table holds. Define it for the app's target to change it.

Definition at line 43 of file registry.hpp.