pyrtc.latency

Latency measurement helpers for pyrtc shared-memory streams.

The helpers in this module stay in the control plane. They attach to existing shared-memory streams, sample timestamp metadata, and summarize latency and jitter without changing the steady-state RTC hot path.

Functions

build_stream_transitions(section_names, ...)

Build stream-to-stream transitions implied by component descriptors.

collect_stream_event_history(streams, samples, *)

Collect per-stream write events over one shared wall-clock window.

compute_count_aligned_latency_seconds(...[, ...])

Estimate latency after aligning source and target events by SHM count.

compute_frame_matched_latency_seconds(...)

Match target writes to the source write that carried the same frame id.

compute_latency_seconds(source_write_times, ...)

Estimate latency samples and compensate for simple frame misalignment.

format_latency_report(report)

Return a readable text summary for a latency report.

infer_stream_path(*, section_names, ...[, ...])

Infer a sensible stream path for latency breakdowns.

measure_stream_path_latency(stream_path, *)

Measure latency across a stream path and return a structured report.

open_stream(shm_name)

Attach a read-only observer handle to an existing SHM stream.

plot_latency_histogram(latency_seconds, *, ...)

Render a log-scaled histogram that highlights high-percentile latency.

wait_for_path_live(streams, stream_path, *)

Block until a frame published on the first stream reaches every later stream.

Classes

LatencyReport(source_shm, target_shm, ...)

LatencySegment(source_shm, target_shm, ...)

LatencyStatistics(sample_count, ...)