Slick Sim 0.10.1
Exchange simulator that shadows real venues for risk-free strategy testing
Loading...
Searching...
No Matches
slick::sim::md_feed::ReplayPacer Class Reference

Decides when a packet captured at some time is due, on the wall clock. More...

#include <md_feed/pcap_replay_source.hpp>

Collaboration diagram for slick::sim::md_feed::ReplayPacer:

Public Member Functions

 ReplayPacer (double speed=1.0)
double speed () const
void anchor (uint64_t capture_ns, uint64_t wall_ns)
 Pins the capture time capture_ns to the wall time wall_ns.
bool anchored () const
uint64_t due_ns (uint64_t capture_ns) const
 The wall time at which a packet captured at capture_ns should go out.
bool is_due (uint64_t capture_ns, uint64_t now_ns) const
 True when the packet may go out at wall time now_ns.
uint64_t rebase_ns (uint64_t capture_ns, uint64_t now_ns) const
 The time to stamp on a packet's events when it goes out at now_ns: its due time, so the replay keeps the capture's spacing, or now_ns when unpaced (speed 0).

Detailed Description

Decides when a packet captured at some time is due, on the wall clock.

Speed 1 releases a packet once as much wall time has passed since the anchor as separated it from the anchor packet in the capture; speed N releases it N times sooner; speed 0 never waits. Not thread-safe.

Definition at line 444 of file pcap_replay_source.hpp.

Constructor & Destructor Documentation

◆ ReplayPacer()

slick::sim::md_feed::ReplayPacer::ReplayPacer ( double speed = 1.0)
inlineexplicit

Definition at line 446 of file pcap_replay_source.hpp.

References speed().

Member Function Documentation

◆ anchor()

void slick::sim::md_feed::ReplayPacer::anchor ( uint64_t capture_ns,
uint64_t wall_ns )
inline

Pins the capture time capture_ns to the wall time wall_ns.

Call when the replay starts, with the first packet's time.

Definition at line 452 of file pcap_replay_source.hpp.

◆ anchored()

bool slick::sim::md_feed::ReplayPacer::anchored ( ) const
inlinenodiscard

Definition at line 458 of file pcap_replay_source.hpp.

◆ due_ns()

uint64_t slick::sim::md_feed::ReplayPacer::due_ns ( uint64_t capture_ns) const
inlinenodiscard

The wall time at which a packet captured at capture_ns should go out.

Definition at line 461 of file pcap_replay_source.hpp.

Referenced by is_due(), and rebase_ns().

◆ is_due()

bool slick::sim::md_feed::ReplayPacer::is_due ( uint64_t capture_ns,
uint64_t now_ns ) const
inlinenodiscard

True when the packet may go out at wall time now_ns.

Definition at line 469 of file pcap_replay_source.hpp.

References due_ns().

◆ rebase_ns()

uint64_t slick::sim::md_feed::ReplayPacer::rebase_ns ( uint64_t capture_ns,
uint64_t now_ns ) const
inlinenodiscard

The time to stamp on a packet's events when it goes out at now_ns: its due time, so the replay keeps the capture's spacing, or now_ns when unpaced (speed 0).

Never later than now_ns.

Definition at line 476 of file pcap_replay_source.hpp.

References due_ns().

◆ speed()

double slick::sim::md_feed::ReplayPacer::speed ( ) const
inlinenodiscard

Definition at line 448 of file pcap_replay_source.hpp.

Referenced by ReplayPacer().


The documentation for this class was generated from the following file: