added data saving feature

This commit is contained in:
Ayzen
2026-06-23 12:19:31 +03:00
parent 716fd0b07a
commit 8db14b9482
20 changed files with 1192 additions and 63 deletions
@@ -281,6 +281,9 @@ class AppWindowPipelineMixin:
else:
self._supervisor.stop()
self._drain_rings_once_for_history()
# Flush any in-progress disk recording so its buffered (not-yet-full) chunk is
# written rather than lost; the drains above already captured the last data.
self._finalize_recording_on_stop()
keep_results_reader = self._supervisor.is_processor_running()
self._close_readers(keep_results=keep_results_reader)
self._single_capture_active = False
@@ -340,6 +343,7 @@ class AppWindowPipelineMixin:
self._read_all_raw()
self._read_all_preprocessed()
result_latest = self._read_all_results() if self._result_reader is not None else None
self._poll_recording_writer() # finalize a disk recording once its writer drains
self._update_history_indicator()
self._last_reader_error_signature = None
self._reader_error_repeat_count = 0
@@ -550,6 +554,7 @@ class AppWindowPipelineMixin:
if collection is None:
break
self._raw_history.append(collection)
self._record_collection("raw", collection)
latest = collection
# `capture_*_ns` are populated by the C++ sweep_orchestrator with
# wallclocks captured around the actual device read. Pre-orchestrator
@@ -573,6 +578,7 @@ class AppWindowPipelineMixin:
if collection is None:
break
self._pre_history.append(collection)
self._record_collection("preprocessed", collection)
def _read_all_results(self) -> ResultCollection | None:
"""Read available result collections from results ring."""
@@ -585,6 +591,7 @@ class AppWindowPipelineMixin:
break
self._pipeline_metrics.record("processing", int(collection.processing_duration_ns))
record_result_history(self._result_history, collection)
self._record_collection("results", collection)
latest = collection
return latest