feat(perception): trace M4.8S pipeline latency
This commit is contained in:
@@ -60,6 +60,7 @@ from k1link.perception.providers import (
|
||||
SourcePacket,
|
||||
)
|
||||
from k1link.perception.recorded_source import (
|
||||
DecodedFrameTiming,
|
||||
DecodedRecordedSource,
|
||||
RecordedRavnoves00Source,
|
||||
RecordedSourceError,
|
||||
@@ -869,6 +870,34 @@ def test_decoded_recorded_source_attaches_images_without_detector_logic(tmp_path
|
||||
assert int(packets[1].image_payload[0, 0, 0]) == 7
|
||||
|
||||
|
||||
def test_decoded_recorded_source_reports_per_frame_decode_timing(tmp_path: Path) -> None:
|
||||
camera_path, timeline_path = _write_recorded_fixture(tmp_path)
|
||||
source = RecordedRavnoves00Source(
|
||||
camera_index_path=camera_path,
|
||||
source_pack_path=timeline_path,
|
||||
expected_frame_count=2,
|
||||
expected_source_pack_sha256=None,
|
||||
)
|
||||
observed: list[DecodedFrameTiming] = []
|
||||
|
||||
class Decoder:
|
||||
def frames(self, _stop_event: Event) -> Iterator[np.ndarray]:
|
||||
yield np.zeros((600, 800, 3), dtype=np.uint8)
|
||||
yield np.zeros((600, 800, 3), dtype=np.uint8)
|
||||
|
||||
packets = list(
|
||||
DecodedRecordedSource(
|
||||
source=source,
|
||||
decoder=Decoder(),
|
||||
timing_observer=observed.append,
|
||||
clock_ns=iter((10, 30, 40, 90, 100)).__next__,
|
||||
).packets(Event())
|
||||
)
|
||||
|
||||
assert len(packets) == 2
|
||||
assert observed == [DecodedFrameTiming(0, 20), DecodedFrameTiming(1, 50)]
|
||||
|
||||
|
||||
def test_decoded_recorded_source_primes_decoder_before_source_clock() -> None:
|
||||
events: list[str] = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user