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

The profiling registry as tagged #PROF lines. More...

Detailed Description

The profiling registry as tagged #PROF lines.

TaggedReporter writes every entry of the registry (registry.hpp), one window per period, so an app does not list what it measures. Each period it asks the registry for a window, and once the measured side has closed it, writes the window:

#PROF cpu_avg=20.5 cpu_peak=21.1 cpu_min=17.3 overruns=0 blocks=48000
#PROF.OSC cycles=85119 min=84012 max=91700 n=1000
#PROF.EDGES count=1423 total=68310
  • The first budget is the #PROF line: the running average, and the window's peak and minimum, as percentages of its limit; the window's overruns; the blocks since the start. A further budget writes the same fields as #PROF.<NAME>.
  • A section writes #PROF.<NAME>: its running average in cycles, the window's smallest and largest pass, and the passes in the window.
  • A counter writes #PROF.<NAME>: the events in the window and since the start.

The name is the registered name in upper case. The lines are tagged-output lines and go to the log sink, so the reporter belongs to the main loop.

format_tagged_histogram() writes a budget's load histogram as a #HIST line.

Gated behind SBL_PROFILING_ENABLED: without it poll() does nothing and returns false.

Usage:

static sbl::system::profiling::TaggedReporter reporter; // a line a second
while (true) { // main loop
reporter.poll<SBL_LOG_OUTPUT>(sbl::system::timer::millis());
}
uint32_t millis()
Definition timer.hpp:65

Definition in file report.hpp.

#include <cmath>
#include <cstddef>
#include <cstdint>
#include <sbl/common/log/format.hpp>
#include <sbl/common/log/tagged.hpp>
#include <sbl/system/profiling/audio_budget.hpp>
#include <sbl/system/profiling/registry.hpp>

Go to the source code of this file.

Classes

class  sbl::system::profiling::TaggedReporter
 

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.
 

Functions

int sbl::system::profiling::format_tagged_histogram (char *buf, size_t size, const AudioBudget &budget)
 Format CPU load histogram as a tagged output line.