diff options
| author | Nicolas James <nj3ahxac@gmail.com> | 2026-04-08 00:56:40 +1000 |
|---|---|---|
| committer | Nicolas James <nj3ahxac@gmail.com> | 2026-04-08 00:56:40 +1000 |
| commit | eb9719cc8b9a308654ccd2c3bce8a7047b6e2a1a (patch) | |
| tree | 5e72b419d3dc900a35921be5e551b17552251769 /src/frame_span.hh | |
| parent | 69764a869d99e9abd0fbe10c2773d3556d7f35e8 (diff) | |
Refactor storing submissions into FrameSpan class, reduce AntiLag thread contention
Diffstat (limited to 'src/frame_span.hh')
| -rw-r--r-- | src/frame_span.hh | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/frame_span.hh b/src/frame_span.hh new file mode 100644 index 0000000..5220702 --- /dev/null +++ b/src/frame_span.hh @@ -0,0 +1,37 @@ +#ifndef FRAME_SPAN_HH_ +#define FRAME_SPAN_HH_ + +#include "timestamp_pool.hh" + +namespace low_latency { + +// A class which contains timestamps that represent a Queue's contribution to +// a frame. It reduces the (possibly) huge amount of TimestampPool::Handle's +// that a queue needs to keep track of. It only keeps at max two - the first +// head handle and the tail handle, which is allowed to be null in the case of +// only a single submission for that queue. +class FrameSpan { + public: + const std::shared_ptr<TimestampPool::Handle> head_handle; + std::shared_ptr<TimestampPool::Handle> tail_handle; + + public: + FrameSpan(std::shared_ptr<TimestampPool::Handle> handle); + FrameSpan(const FrameSpan&) = delete; + FrameSpan(FrameSpan&&) = delete; + FrameSpan operator=(const FrameSpan&) = delete; + FrameSpan operator=(FrameSpan&&) = delete; + ~FrameSpan(); + + public: + // Update the framespan's tail to include this timestamp. + void update(std::shared_ptr<TimestampPool::Handle> handle); + + public: + // Wait for for GPU work to complete. + void await_completed() const; +}; + +} // namespace low_latency + +#endif
\ No newline at end of file |
