retain telemetry across transport outages
This commit is contained in:
+11
-2
@@ -7,6 +7,7 @@ from pathlib import Path
|
||||
|
||||
from trikke_protocol import (
|
||||
CSV_COLUMNS,
|
||||
PACKET_FLAG_TIMESTAMP_DELTA_SATURATED,
|
||||
PACKET_TYPE_METADATA,
|
||||
Frame,
|
||||
StreamParser,
|
||||
@@ -31,15 +32,21 @@ def main() -> int:
|
||||
None,
|
||||
)
|
||||
if metadata is None:
|
||||
print("No valid metadata frame found")
|
||||
print(
|
||||
"No valid metadata frame found; "
|
||||
f"trailing_partial_bytes={stream.buffered_bytes}"
|
||||
)
|
||||
return 2
|
||||
|
||||
args.output.parent.mkdir(parents=True, exist_ok=True)
|
||||
sample_count = 0
|
||||
timestamp_saturation_frame_count = 0
|
||||
with args.output.open("w", encoding="utf-8", newline="") as target:
|
||||
writer = csv.writer(target)
|
||||
writer.writerow(CSV_COLUMNS)
|
||||
for frame in frames:
|
||||
if frame.flags & PACKET_FLAG_TIMESTAMP_DELTA_SATURATED:
|
||||
timestamp_saturation_frame_count += 1
|
||||
if frame.packet_type == PACKET_TYPE_METADATA:
|
||||
if frame.metadata is not None:
|
||||
metadata = frame.metadata
|
||||
@@ -54,7 +61,9 @@ def main() -> int:
|
||||
f"Decoded {sample_count} samples from {len(frames)} frames; "
|
||||
f"startup_crc_rejects={stream.startup_crc_errors}, "
|
||||
f"stream_crc_errors={stream.crc_errors}, header_errors={stream.header_errors}, "
|
||||
f"skipped_nonframe_bytes={stream.skipped_bytes}; saved {args.output}"
|
||||
f"skipped_nonframe_bytes={stream.skipped_bytes}, "
|
||||
f"timestamp_saturation_frames={timestamp_saturation_frame_count}, "
|
||||
f"trailing_partial_bytes={stream.buffered_bytes}; saved {args.output}"
|
||||
)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user