Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
perf_counters.hpp File Reference

Benchmark perf counters for copy/upload/readback costs. More...

Go to the source code of this file.

Detailed Description

Benchmark perf counters for copy/upload/readback costs.

This header is compiled out entirely when PULP_BENCHMARK is not defined, so the production audio/UI paths see zero overhead by default.

Counters accumulate microseconds (or byte counts) via std::atomic<double>::fetch_add. Writers on different threads (audio thread, UI thread, GPU poll thread) can all accumulate concurrently without a lock. A periodic consumer calls snapshot_and_reset() to grab the rolling totals and zero them for the next window.

Usage: #ifdef PULP_BENCHMARK using namespace pulp::render::bench; double t0 = now_us(); // ... do work ... counters.audio_copy_total_us.fetch_add( now_us() - t0, std::memory_order_relaxed); #endif