spacr.qt.startup_benchmark¶
Controlled real-entry-point startup and module-readiness benchmark.
This module is imported only when SPACR_BENCHMARK_JSON names an output
file. The ordinary application therefore pays no import or QObject cost for
it. The benchmark still runs the ordinary spacr.qt.run path: once Home
has really painted, it presses each live sidebar button and waits for the
production timing probe to observe a painted, enabled control. After the
last registry key it writes one JSON artifact and exits Qt deliberately.
Classes¶
Advance through Home and an exact snapshot of the live app registry. |
Functions¶
|
Install the controller named by the environment, or return |
Module Contents¶
- class spacr.qt.startup_benchmark.BenchmarkController(app, window, keys: Iterable[str], output: str, *, timeout_s: float | None = None, live_keys: Callable[[], Iterable[str]] | None = None, measure_preferences: bool | None = None, preferences_factory: Callable[[], object] | None = None)[source]¶
Bases:
PySide6.QtCore.QObjectAdvance through Home and an exact snapshot of the live app registry.
- Parameters:
app – the running
QApplication, also this object’s parent.window – the main window to drive.
keys – the module keys to visit, in order.
output – where to write the measurements.
timeout_s – how long one module may take before the run is abandoned.
Noneuses the default.live_keys – called for the registry as it stands NOW, so a run can check the snapshot in
keysstill matches the app it is driving.measure_preferences – whether to open Preferences and time it.
Nonedecides from the environment.preferences_factory – builds the Preferences dialog, so a test can supply one without the real dialog.
Drive the benchmark: open each module in turn and time it.
- Parameters:
app – the running QApplication.
window – the main window to drive.
keys – the modules to open, in order.
output – where to write the artifact.
timeout_s – how long one module may take before the run fails.
live_keys – modules whose readiness is signalled rather than polled.
measure_preferences – whether to time the Preferences dialog too.
preferences_factory – how to build that dialog.
- spacr.qt.startup_benchmark.maybe_start(app, window) BenchmarkController | _DistributionSmokeController | None[source]¶
Install the controller named by the environment, or return
None.- Parameters:
app – the running
QApplication, passed to the controller.window – the main window the benchmark drives.
- Returns:
the registry benchmark controller, or the installed-application controller when
SPACR_DISTRIBUTION_SMOKE=1is explicitly selected;Nonewhen no output path is configured.
Nested helpers¶
- BenchmarkController._advance_after_watchdog._after_beat() None¶
Continue once the GUI thread has answered again.
spacr/qt/startup_benchmark.py:270
- _DistributionSmokeController._layout_snapshot.coordinates(rect)¶
Retain integer geometry in a JSON-compatible representation.
- Parameters:
rect – the observed Qt rectangle.
spacr/qt/startup_benchmark.py:846
- _DistributionSmokeController._layout_snapshot.rectangle(widget)¶
Map actual geometry into the window.
- Parameters:
widget – the real child widget being measured.
spacr/qt/startup_benchmark.py:839
Read a native NSString without inventing an action caption.
spacr/qt/startup_benchmark.py:1201