QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstHwPathTelemetry.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/QElapsedTimer>
4#include <QtCore/qglobal.h>
5
6#include "GstHwVideoBufferFactory.h" // HwVideoBufferPath enum
7
8#if defined(QGC_HAS_ANY_GPU_PATH)
9#include <private/qhwvideobuffer_p.h>
10#endif
11
14namespace GstHwPathTelemetry {
15
32
34void recordMapFailure(HwVideoBufferPath path) noexcept;
35quint64 takeMapFailureCount(HwVideoBufferPath path) noexcept;
36quint64 peekMapFailureCount(HwVideoBufferPath path) noexcept;
37
39void recordTextureReuse(HwVideoBufferPath path) noexcept;
40quint64 takeTextureReuseHits(HwVideoBufferPath path) noexcept;
41
43void recordSyncWait(HwVideoBufferPath path, bool gpuSide) noexcept;
45quint64 takeSyncWaitCounts(HwVideoBufferPath path, quint64& gpuWaits) noexcept;
46
48void recordImageCacheHit(HwVideoBufferPath path) noexcept;
49void recordImageCacheMiss(HwVideoBufferPath path) noexcept;
50quint64 takeImageCacheHits(HwVideoBufferPath path) noexcept;
51quint64 takeImageCacheMisses(HwVideoBufferPath path) noexcept;
52
53#if defined(QGC_HAS_ANY_GPU_PATH)
55QVideoFrameTexturesUPtr fail(HwVideoBufferPath path) noexcept;
56#endif
57
59void recordDelivered(HwVideoBufferPath path) noexcept;
60quint64 peekDeliveredCount(HwVideoBufferPath path) noexcept;
61quint64 takeDeliveredCount(HwVideoBufferPath path) noexcept;
62
64void recordMapDuration(HwVideoBufferPath path, qint64 nsecs) noexcept;
65quint64 peekMapDurationUsEwma(HwVideoBufferPath path) noexcept;
66
69{
70public:
71 explicit ScopedMapTimer(HwVideoBufferPath path) noexcept : _path(path) { _timer.start(); }
72 ~ScopedMapTimer() noexcept { recordMapDuration(_path, _timer.nsecsElapsed()); }
75
76private:
78 QElapsedTimer _timer;
79};
80
82void recordFenceTimeout(HwVideoBufferPath path) noexcept;
83quint64 peekFenceTimeouts(HwVideoBufferPath path) noexcept;
84quint64 takeFenceTimeouts(HwVideoBufferPath path) noexcept;
85
87void recordMmapBarrierHit(HwVideoBufferPath path) noexcept;
88quint64 peekMmapBarrierHits(HwVideoBufferPath path) noexcept;
89quint64 takeMmapBarrierHits(HwVideoBufferPath path) noexcept;
90
93quint64 takeExplicitFenceWaits(HwVideoBufferPath path) noexcept;
94
96void recordFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept;
97quint64 peekFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept;
98quint64 takeFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept;
99
101void recordStreamDemotion(HwVideoBufferPath negotiated) noexcept;
102quint64 takeStreamDemotions(HwVideoBufferPath negotiated) noexcept;
103
104} // namespace GstHwPathTelemetry
HwVideoBufferPath
Identifies which GPU path was chosen; used by the adapter to increment the right counter.
RAII timer: records mapTextures() wall time into the path's EWMA on scope exit.
ScopedMapTimer(HwVideoBufferPath path) noexcept
ScopedMapTimer & operator=(const ScopedMapTimer &)=delete
ScopedMapTimer(const ScopedMapTimer &)=delete
void recordSyncWait(HwVideoBufferPath path, bool gpuSide) noexcept
GL fence sync wait; split CPU-blocking vs GPU-side.
quint64 peekMapFailureCount(HwVideoBufferPath path) noexcept
quint64 takeExplicitFenceWaits(HwVideoBufferPath path) noexcept
quint64 peekFenceTimeouts(HwVideoBufferPath path) noexcept
void recordFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
Per-(path,reason) fallback accounting; lets a bug report show why a path demoted to CPU.
quint64 takeTextureReuseHits(HwVideoBufferPath path) noexcept
void recordMapDuration(HwVideoBufferPath path, qint64 nsecs) noexcept
Per-path mapTextures() wall-time, fed into an EWMA; peek returns the smoothed value in microseconds.
quint64 peekFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
quint64 takeImageCacheHits(HwVideoBufferPath path) noexcept
quint64 peekMmapBarrierHits(HwVideoBufferPath path) noexcept
void recordImageCacheHit(HwVideoBufferPath path) noexcept
Native image/texture cache hit/miss accounting.
quint64 takeSyncWaitCounts(HwVideoBufferPath path, quint64 &gpuWaits) noexcept
Reads-and-resets CPU waits; writes GPU waits into gpuWaits.
quint64 peekMapDurationUsEwma(HwVideoBufferPath path) noexcept
quint64 takeFenceTimeouts(HwVideoBufferPath path) noexcept
void recordStreamDemotion(HwVideoBufferPath negotiated) noexcept
One-shot-per-epoch event: a stream that negotiated a HW path demoted to CPU. Distinct from per-frame ...
void recordImageCacheMiss(HwVideoBufferPath path) noexcept
void recordExplicitFenceWait(HwVideoBufferPath path) noexcept
DMABuf imported the producer's dma-buf/native fence and did a GPU-side wait (skipped the mmap barrier...
quint64 takeStreamDemotions(HwVideoBufferPath negotiated) noexcept
void recordFenceTimeout(HwVideoBufferPath path) noexcept
DMABuf EGL fence wait timed out (GPU stall) and fell through to the mmap barrier.
quint64 peekDeliveredCount(HwVideoBufferPath path) noexcept
quint64 takeMapFailureCount(HwVideoBufferPath path) noexcept
void recordDelivered(HwVideoBufferPath path) noexcept
Frames successfully delivered via this path.
quint64 takeImageCacheMisses(HwVideoBufferPath path) noexcept
void recordTextureReuse(HwVideoBufferPath path) noexcept
Prior frame's QRhiTexture wrappers reused (decoder pool returned same native handle).
void recordMmapBarrierHit(HwVideoBufferPath path) noexcept
DMABuf mmap CPU-side completion barrier taken (no usable fence ext).
void recordMapFailure(HwVideoBufferPath path) noexcept
mapTextures() returned an invalid bundle (GPU import failed).
quint64 takeDeliveredCount(HwVideoBufferPath path) noexcept
quint64 takeFallbackReason(HwVideoBufferPath attemptedPath, HwFallbackReason reason) noexcept
HwFallbackReason
Specific cause a HW path was rejected for a sample; surfaced as a per-(path,reason) breakdown.
quint64 takeMmapBarrierHits(HwVideoBufferPath path) noexcept