47#ifndef PULP_RT_WORK_COUNTERS
48#define PULP_RT_WORK_COUNTERS 0
60 std::uint64_t
fft = 0;
66 return {
a.fft - b.fft,
a.trig - b.trig,
a.bins - b.bins};
70 return {
a.fft + b.fft,
a.trig + b.trig,
a.bins + b.bins};
76#if PULP_RT_WORK_COUNTERS
77inline std::atomic<std::uint64_t> g_fft_count{0};
78inline std::atomic<std::uint64_t> g_trig_count{0};
79inline std::atomic<std::uint64_t> g_bins_count{0};
85#if PULP_RT_WORK_COUNTERS
86 detail::g_fft_count.fetch_add(1, std::memory_order_relaxed);
92#if PULP_RT_WORK_COUNTERS
93 detail::g_trig_count.fetch_add(n, std::memory_order_relaxed);
101#if PULP_RT_WORK_COUNTERS
102 detail::g_bins_count.fetch_add(n, std::memory_order_relaxed);
111#if PULP_RT_WORK_COUNTERS
112 return {detail::g_fft_count.load(std::memory_order_relaxed),
113 detail::g_trig_count.load(std::memory_order_relaxed),
114 detail::g_bins_count.load(std::memory_order_relaxed)};
133inline std::complex<T>
polar(T magnitude, T phase)
noexcept {
135 return std::polar(magnitude, phase);
140inline T
sin(T x)
noexcept {
147inline T
cos(T x)
noexcept {
154inline T
exp(T x)
noexcept {
161inline T
arg(
const std::complex<T>& z)
noexcept {
RtWorkCounter() noexcept
Definition rt_work_counter.hpp:123
void restart() noexcept
Definition rt_work_counter.hpp:125
RtWorkCounts delta() const noexcept
Definition rt_work_counter.hpp:124
Definition rt_work_counter.hpp:75
Definition rt_work_counter.hpp:51
RtWorkCounts work_counts() noexcept
Current process-wide totals.
Definition rt_work_counter.hpp:110
T cos(T x) noexcept
Counted std::cos. Bit-identical result.
Definition rt_work_counter.hpp:147
void count_trig(std::uint64_t n=1) noexcept
Record n transcendental evaluations.
Definition rt_work_counter.hpp:91
T exp(T x) noexcept
Counted std::exp. Bit-identical result.
Definition rt_work_counter.hpp:154
constexpr bool kWorkCountersEnabled
True when this build counts operations.
Definition rt_work_counter.hpp:56
std::complex< T > polar(T magnitude, T phase) noexcept
Counted std::polar. Bit-identical result.
Definition rt_work_counter.hpp:133
T sin(T x) noexcept
Counted std::sin. Bit-identical result.
Definition rt_work_counter.hpp:140
void count_fft() noexcept
Record one FFT execution.
Definition rt_work_counter.hpp:84
void count_bins(std::uint64_t n) noexcept
Record n units of per-bin accumulation work.
Definition rt_work_counter.hpp:100
T arg(const std::complex< T > &z) noexcept
Counted std::arg (an atan2). Bit-identical result.
Definition rt_work_counter.hpp:161
@ a
Definition formant_filter_bank.hpp:20
#define PULP_RT_WORK_COUNTERS
Definition rt_work_counter.hpp:48
A snapshot (or a difference of two snapshots) of the counted operations.
Definition rt_work_counter.hpp:59
std::uint64_t fft
Definition rt_work_counter.hpp:60
friend constexpr RtWorkCounts operator+(RtWorkCounts a, RtWorkCounts b) noexcept
Definition rt_work_counter.hpp:68
friend constexpr bool operator==(RtWorkCounts, RtWorkCounts)=default
std::uint64_t trig
Definition rt_work_counter.hpp:61
std::uint64_t bins
Definition rt_work_counter.hpp:62
friend constexpr RtWorkCounts operator-(RtWorkCounts a, RtWorkCounts b) noexcept
Definition rt_work_counter.hpp:64