3#if defined(PULP_GPU_RUNTIME)
7#include <gpu_runtime/gpu_render_time.hpp>
10using gpu_runtime::gpu_render_ns_to_ms;
11using gpu_runtime::gpu_surface_disabled_toggles;
12using gpu_runtime::GpuFramesInFlight;
13using gpu_runtime::GpuRenderTimeTracker;
14using gpu_runtime::kDawnTimestampQuantizationToggle;
15using gpu_runtime::kGpuRenderNanosecondsPerMillisecond;
76[[nodiscard]]
inline std::vector<const char*>
78 std::vector<const char*> disabled;
79 if (timestamp_query_requested) {
92[[nodiscard]]
inline std::optional<double>
94 if (!callback_ok || elapsed_ns == 0) {
113 void store(std::uint64_t elapsed_ns,
bool callback_ok) {
115 last_ms_.store(*ms, std::memory_order_relaxed);
116 have_sample_.store(
true, std::memory_order_relaxed);
123 return have_sample_.load(std::memory_order_relaxed);
129 return last_ms_.load(std::memory_order_relaxed);
133 std::atomic<double> last_ms_{0.0};
134 std::atomic<bool> have_sample_{
false};
147 void on_submitted() { count_.fetch_add(1, std::memory_order_relaxed); }
149 int current = count_.load(std::memory_order_relaxed);
150 while (current > 0 &&
151 !count_.compare_exchange_weak(current, current - 1,
152 std::memory_order_relaxed)) {}
154 [[nodiscard]]
int count()
const {
return count_.load(std::memory_order_relaxed); }
157 std::atomic<int> count_{0};
Frames whose GPU work has been submitted but has not finished executing.
Definition gpu_render_time.hpp:145
void on_finished()
Definition gpu_render_time.hpp:148
int count() const
Definition gpu_render_time.hpp:154
void on_submitted()
Definition gpu_render_time.hpp:147
Thread-safe holder for the latest GPU render-time sample.
Definition gpu_render_time.hpp:108
bool have_sample() const
True once at least one valid sample has landed.
Definition gpu_render_time.hpp:122
double last_ms() const
The most recent valid GPU render duration in milliseconds (0 until the first sample lands).
Definition gpu_render_time.hpp:128
void store(std::uint64_t elapsed_ns, bool callback_ok)
Store a sample from the finished-with-stats callback.
Definition gpu_render_time.hpp:113
Definition gpu_fwd.hpp:31
constexpr const char * kDawnTimestampQuantizationToggle
Dawn's timestamp_quantization toggle, which defaults to ON in native Dawn (not only in Chrome) and AN...
Definition gpu_render_time.hpp:70
std::optional< double > gpu_render_ns_to_ms(std::uint64_t elapsed_ns, bool callback_ok)
Convert a Graphite GpuStats::elapsedTime sample into a millisecond duration.
Definition gpu_render_time.hpp:93
std::vector< const char * > gpu_surface_disabled_toggles(bool timestamp_query_requested)
Dawn toggles that must be DISABLED for the requested device features.
Definition gpu_render_time.hpp:77
constexpr double kGpuRenderNanosecondsPerMillisecond
Whole-recording GPU render time.
Definition gpu_render_time.hpp:51