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
sbl::system::profiling Namespace Reference

Profiling: the cycle counter, the audio budget, section profiles and reports. More...

Detailed Description

Profiling: the cycle counter, the audio budget, section profiles and reports.

Classes

class  AudioBudget
 Cycle budget of the audio callback: load, peak, minimum, overruns and a load histogram. More...
 
class  Counter
 
struct  CycleScope
 
struct  Entry
 
struct  Registry
 The header and the table. More...
 
class  SectionProfile
 
class  TaggedReporter
 

Enumerations

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

Functions

void init ()
 
void init_for_profiling ()
 
uint32_t cycles ()
 
constexpr uint32_t cycle_rate ()
 
int format_tagged_histogram (char *buf, size_t size, const AudioBudget &budget)
 Format CPU load histogram as a tagged output line.
 

Variables

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

Enumeration Type Documentation

◆ Kind

enum class sbl::system::profiling::Kind : uint8_t
strong

What an entry measures: the value of its kind field.

Definition at line 57 of file registry.hpp.

Function Documentation

◆ init()

void sbl::system::profiling::init ( )
inline

Start the counter. Call once at startup, after clock configuration.

Definition at line 26 of file cycles.hpp.

Referenced by init_for_profiling().

◆ init_for_profiling()

void sbl::system::profiling::init_for_profiling ( )
inline

init() in a build with SBL_PROFILING and nothing otherwise, for an app whose measurements are all gated by it.

Definition at line 32 of file cycles.hpp.

References init().

◆ cycles()

uint32_t sbl::system::profiling::cycles ( )
inline

The current count (free-running, wraps at 2^32).

Definition at line 39 of file cycles.hpp.

Referenced by sbl::system::profiling::Entry::measure(), sbl::system::profiling::AudioBudget::on_block_end(), and sbl::system::profiling::AudioBudget::on_block_start().

◆ cycle_rate()

constexpr uint32_t sbl::system::profiling::cycle_rate ( )
inlineconstexpr

Counts per second.

Definition at line 42 of file cycles.hpp.

Referenced by sbl::system::profiling::AudioBudget::init().

◆ format_tagged_histogram()

int sbl::system::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 218 of file report.hpp.

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

Variable Documentation

◆ REGISTRY_MAGIC

constexpr uint32_t sbl::system::profiling::REGISTRY_MAGIC = 0x464F5250u
inlineconstexpr

the bytes "PROF", little-endian

Definition at line 48 of file registry.hpp.

◆ REGISTRY_VERSION

constexpr uint32_t sbl::system::profiling::REGISTRY_VERSION = 1
inlineconstexpr

layout version this header writes

Definition at line 49 of file registry.hpp.

◆ REGISTRY_CAPACITY

constexpr size_t sbl::system::profiling::REGISTRY_CAPACITY = SBL_PROFILING_REGISTRY_CAPACITY
inlineconstexpr

entries the table holds

Definition at line 50 of file registry.hpp.

◆ NAME_SIZE

constexpr size_t sbl::system::profiling::NAME_SIZE = 12
inlineconstexpr

an entry's name field, terminator included

Definition at line 51 of file registry.hpp.

◆ NO_MINIMUM

constexpr uint32_t sbl::system::profiling::NO_MINIMUM = 0xFFFFFFFFu
inlineconstexpr

min before the window's first measurement

Definition at line 52 of file registry.hpp.

Referenced by sbl::system::profiling::Entry::close_window(), and sbl::system::profiling::Entry::open_window().

◆ REGISTRY_HEADER_SIZE

constexpr uint32_t sbl::system::profiling::REGISTRY_HEADER_SIZE = 40
inlineconstexpr

bytes from the symbol to the first entry

Definition at line 229 of file registry.hpp.

◆ REGISTRY_ENTRY_SIZE

constexpr uint32_t sbl::system::profiling::REGISTRY_ENTRY_SIZE = 64
inlineconstexpr

bytes an entry takes

Definition at line 230 of file registry.hpp.