SaturnRingLibrary 0.9.2
SGL wrapper
Loading...
Searching...
No Matches

◆ Capture()

Tickstamp SRL::Timer::Capture ( )
inlinestaticnoexcept

Captures current hardware state into a Tickstamp.

Returns
Tickstamp containing the current 48-bit timer value.
When to Use:
  • Benchmarking and performance profiling
  • Measuring precise elapsed time between two operations
  • Starting a new timing operation that requires a fresh timestamp
  • Deadline checking where absolute latest time is critical
When to Use CurrentTickstamp() Instead:
  • Displaying current time in UI/debug output (no hardware read overhead)
  • Calculating time remaining in a frame
  • Any in-frame timing that doesn't require a fresh hardware read
Performance Consideration:
Capture() reads hardware registers on each call. For in-frame operations where you need the current time multiple times, prefer CurrentTickstamp() which returns a const reference to the timestamp already captured by Update().
Usage:
Call at the start and end of an operation to measure elapsed time:
// ... perform operation ...
Tickstamp elapsed = end - start;
Fxp seconds = elapsed.ToSeconds();
Math::Types::Fxp ToSeconds() const noexcept
Converts ticks to seconds using DVU hardware acceleration.
Definition srl_timer.hpp:528
High-precision 48-bit timestamp with DVU hardware acceleration.
Definition srl_timer.hpp:58
static Tickstamp Capture() noexcept
Captures current hardware state into a Tickstamp.
Definition srl_timer.hpp:1082
Note
This function uses a memory barrier to ensure consistent ordering of FRT and timer32 reads. The overhead is minimal (~1-2 cycles).
See also
CurrentTickstamp() for in-frame timing without hardware read overhead