STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
BoardClockSync Class Reference

Unit tests for fsw::time::BoardClockSync (pure, deterministic — no sockets, no real clock). More...

#include <BoardClockSync.hpp>

Collaboration diagram for BoardClockSync:
[legend]

Classes

struct  BoardStats
struct  BoardState

Public Member Functions

 BoardClockSync (const TimeSyncConfig &cfg)
std::vector< uint64_t > stamp_packet (const std::string &board_key, uint64_t arrival_ns, const std::vector< uint32_t > &chunk_ms)
 Stamp one packet's chunks for one board.
BoardStats stats (const std::string &board_key) const
 Stats for one board (default-constructed if unknown).
std::vector< std::string > boards () const
 All boards seen (for periodic diagnostics logging).

Private Member Functions

void resync (BoardState &s, uint32_t newest_raw_ms, uint64_t arrival_ns, bool count)

Private Attributes

TimeSyncConfig cfg_
std::map< std::string, BoardState > boards_

Detailed Description

Unit tests for fsw::time::BoardClockSync (pure, deterministic — no sockets, no real clock).

House style: plain main(), return 0 on pass / 1 on failure (see test_sequencer_elodin.cpp). Registered with CTest in lib/CMakeLists.txt.

Edge-case matrix (from the time-sync design):

  1. within-packet spreading 6. uint32 wrap mid-packet
  2. min-filter under one-sided jitter 7. safety clamp → arrival fallback
  3. crystal drift (both signs) 8. per-board monotonic guard
  4. reboot → resync → re-lock 9. multi-board independence
  5. uint32 wrap between packets 10. arrival mode (revert switch)

Definition at line 61 of file BoardClockSync.hpp.

Constructor & Destructor Documentation

◆ BoardClockSync()

Definition at line 63 of file BoardClockSync.hpp.

Member Function Documentation

◆ boards()

std::vector< std::string > fsw::time::BoardClockSync::boards ( ) const

All boards seen (for periodic diagnostics logging).

Definition at line 158 of file BoardClockSync.cpp.

◆ resync()

void fsw::time::BoardClockSync::resync ( BoardState & s,
uint32_t newest_raw_ms,
uint64_t arrival_ns,
bool count )
private

Definition at line 26 of file BoardClockSync.cpp.

◆ stamp_packet()

std::vector< uint64_t > fsw::time::BoardClockSync::stamp_packet ( const std::string & board_key,
uint64_t arrival_ns,
const std::vector< uint32_t > & chunk_ms )

Stamp one packet's chunks for one board.

Parameters
board_keystable identity of the source board (source IP)
arrival_nsserver receive time of the packet (epoch ns)
chunk_msthe packet's chunk timestamps in send order (board uint32 millis; may wrap mid-packet)
Returns
one epoch-ns timestamp per chunk, same order as chunk_ms

Definition at line 42 of file BoardClockSync.cpp.

◆ stats()

BoardClockSync::BoardStats fsw::time::BoardClockSync::stats ( const std::string & board_key) const

Stats for one board (default-constructed if unknown).

Definition at line 153 of file BoardClockSync.cpp.

Member Data Documentation

◆ boards_

std::map<std::string, BoardState> fsw::time::BoardClockSync::boards_
private

Definition at line 109 of file BoardClockSync.hpp.

◆ cfg_


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