11std::array<std::array<std::atomic<quint64>, kCounterCount>,
GstHw::kPathCount> s_counters{};
16std::array<std::array<std::atomic<quint64>, kReasonCount>,
GstHw::kPathCount> s_fallbackReasons{};
22 s_counters[size_t(path)][size_t(counter)].fetch_add(1, std::memory_order_relaxed);
31 const quint64 sampleUs =
static_cast<quint64
>(nsecs) / 1000;
32 auto& ewma = s_mapDurationUsEwma[size_t(path)];
33 quint64 prev = ewma.load(std::memory_order_relaxed);
36 next = (prev == 0) ? sampleUs : prev - (prev >> 3) + (sampleUs >> 3);
37 }
while (!ewma.compare_exchange_weak(prev, next, std::memory_order_relaxed));
42 return s_mapDurationUsEwma[size_t(path)].load(std::memory_order_relaxed);
47 s_fallbackReasons[size_t(attemptedPath)][size_t(reason)].fetch_add(1, std::memory_order_relaxed);
54 for (
size_t counter = 0; counter < kCounterCount; ++counter) {
55 out.
counters[path][counter] = s_counters[path][counter].load(std::memory_order_relaxed);
57 for (
size_t reason = 0; reason < kReasonCount; ++reason) {
58 out.
fallbackReasons[path][reason] = s_fallbackReasons[path][reason].load(std::memory_order_relaxed);
HwVideoBufferPath
GPU zero-copy path a frame is imported through; None means the frame takes the CPU path.
Counter
Per-path event counts.
void recordFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
Per-(path,reason) fallback accounting; lets a bug report show why a path demoted to CPU.
void recordMapDuration(HwVideoBufferPath path, qint64 nsecs) noexcept
Per-path mapTextures() wall-time, fed into an EWMA; peek returns the smoothed value in microseconds.
void record(HwVideoBufferPath path, Counter counter) noexcept
quint64 peekMapDurationUsEwma(HwVideoBufferPath path) noexcept
Snapshot snapshot() noexcept
HwFallbackReason
Specific cause a GPU path was rejected for a sample; surfaced as a per-(path,reason) breakdown.
constexpr std::size_t kPathCount
Every counter and fallback reason at one instant; a reader's baseline for counts since then.
std::array< std::array< quint64, std::size_t(HwFallbackReason::Count)>, GstHw::kPathCount > fallbackReasons
std::array< std::array< quint64, std::size_t(Counter::Count)>, GstHw::kPathCount > counters