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

Profiling report formatters (human-readable and tagged) More...

#include <cstdint>
#include <cstddef>
#include <sbl/profiling/audio_budget.hpp>
#include <sbl/log/format.hpp>
Include dependency graph for report.hpp:

Go to the source code of this file.

Classes

struct  sbl::profiling::NamedSection
 

Namespaces

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

Functions

int sbl::profiling::format_report (char *buf, size_t size, const AudioBudget &budget, const NamedSection *sections, size_t n)
 Format a profiling report into a buffer.
 
int sbl::profiling::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 sbl::profiling::format_tagged_histogram (char *buf, size_t size, const AudioBudget &budget)
 Format CPU load histogram as a tagged output line.
 

Detailed Description

Profiling report formatters (human-readable and tagged)

Formats AudioBudget + named SectionProfiles into log-friendly strings. Gated behind SBL_PROFILING_ENABLED — compiles to nothing when disabled.

Two output modes:

Human-readable (format_report): CPU: avg=36.9% peak=38.8% overruns=0 osc=85119 svf=12928 verb=41100 dly=9344

Tagged (format_tagged_report + format_tagged_histogram): #PROF cpu_avg=36.9 cpu_peak=38.8 cpu_min=34.2 overruns=0 blocks=48000 #PROF.OSC cycles=85119 #PROF.SVF cycles=12928 #HIST b0_10=0 b10_20=0 b20_30=150 b30_40=47200 ...

See docs/conventions/tagged-output.md for the tagged output spec.

Usage: sbl::profiling::NamedSection sections[] = { {"osc", s_prof_osc.avg}, {"svf", s_prof_svf.avg}, }; char buf[256]; sbl::profiling::format_tagged_report(buf, sizeof(buf), s_budget, sections, 2); uart_write(buf); sbl::profiling::format_tagged_histogram(buf, sizeof(buf), s_budget); uart_write(buf);

Definition in file report.hpp.