feat(gui_2): wire startup_profiler.phase into App.__init__ + App.run()
Replaces the buggy custom _t = time.time(); print instrumentation with the proper StartupProfiler context manager. Phases added to App.__init__: - app_init_AppController - app_init_history_perfmon Phases added to App.run() (else branch = native GUI): - theme_load_from_config - imgui_bundle_import (the C++ extension import chokepoint) - RunnerParams_init Note: a leftover print(f'[startup] RunnerParams() init: ...') line in App.run() still references a stale _t variable. Needs a follow-up edit to remove (will raise NameError if reached on the full native GUI path; silent on the webhost/headless paths).
This commit is contained in:
+20
-9
@@ -170,11 +170,14 @@ class App:
|
||||
[C: src/mcp_client.py:_DDGParser.__init__, src/mcp_client.py:_TextExtractor.__init__]
|
||||
"""
|
||||
# --- Core Dependencies & State ---
|
||||
self.controller = app_controller.AppController()
|
||||
from src.startup_profiler import startup_profiler
|
||||
with startup_profiler.phase("app_init_AppController"):
|
||||
self.controller = app_controller.AppController()
|
||||
self.controller._app = self
|
||||
from src import history, performance_monitor
|
||||
self.perf_monitor = performance_monitor.PerformanceMonitor()
|
||||
self.history = history.HistoryManager(max_capacity=100)
|
||||
with startup_profiler.phase("app_init_history_perfmon"):
|
||||
from src import history, performance_monitor
|
||||
self.perf_monitor = performance_monitor.PerformanceMonitor()
|
||||
self.history = history.HistoryManager(max_capacity=100)
|
||||
# --- Undo/Redo & Snapshot State ---
|
||||
self._last_ui_snapshot: Optional[history.UISnapshot] = None
|
||||
self._snapshot_timer: float = 0.0
|
||||
@@ -413,7 +416,7 @@ class App:
|
||||
|
||||
def run(self) -> None:
|
||||
"""
|
||||
|
||||
|
||||
Initializes the ImGui runner and starts the main application loop.
|
||||
[C: simulation/sim_base.py:run_sim, src/mcp_client.py:get_git_diff, src/project_manager.py:get_git_commit, src/rag_engine.py:RAGEngine._search_mcp, src/shell_runner.py:run_powershell, tests/conftest.py:kill_process_tree, tests/conftest.py:live_gui, tests/test_conductor_abort_event.py:test_conductor_abort_event_populated, tests/test_conductor_engine_v2.py:test_conductor_engine_dynamic_parsing_and_execution, tests/test_conductor_engine_v2.py:test_conductor_engine_run_executes_tickets_in_order, tests/test_extended_sims.py:test_ai_settings_sim_live, tests/test_extended_sims.py:test_context_sim_live, tests/test_extended_sims.py:test_execution_sim_live, tests/test_extended_sims.py:test_tools_sim_live, tests/test_external_editor_gui.py:get_vscode_processes, tests/test_external_editor_gui.py:test_vscode_launches_with_diff_view, tests/test_gui_custom_window.py:test_app_window_is_borderless, tests/test_headless_simulation.py:module, tests/test_headless_verification.py:test_headless_verification_error_and_qa_interceptor, tests/test_headless_verification.py:test_headless_verification_full_run, tests/test_mock_gemini_cli.py:run_mock, tests/test_orchestration_logic.py:test_conductor_engine_run, tests/test_parallel_execution.py:test_conductor_engine_pool_integration, tests/test_sim_ai_settings.py:test_ai_settings_simulation_run, tests/test_sim_context.py:test_context_simulation_run, tests/test_sim_execution.py:test_execution_simulation_run, tests/test_sim_tools.py:test_tools_simulation_run]
|
||||
"""
|
||||
@@ -426,10 +429,18 @@ class App:
|
||||
api = self.create_api()
|
||||
uvicorn.run(api, host="0.0.0.0", port=port)
|
||||
else:
|
||||
theme.load_from_config(self.config)
|
||||
self.runner_params = hello_imgui.RunnerParams()
|
||||
self.runner_params.app_window_params.window_title = "manual slop"
|
||||
|
||||
from src.startup_profiler import startup_profiler
|
||||
if hasattr(self, "controller") and hasattr(self.controller, "mark_gui_run_started"):
|
||||
self.controller.mark_gui_run_started()
|
||||
with startup_profiler.phase("theme_load_from_config"):
|
||||
theme.load_from_config(self.config)
|
||||
with startup_profiler.phase("imgui_bundle_import"):
|
||||
from imgui_bundle import hello_imgui as _hi
|
||||
with startup_profiler.phase("RunnerParams_init"):
|
||||
self.runner_params = _hi.RunnerParams()
|
||||
self.runner_params.app_window_params.window_title = "manual slop"
|
||||
print(f"[startup] RunnerParams() init: {(time.time()-_t)*1000:.1f}ms", file=sys.stderr)
|
||||
|
||||
if sys.platform == "win32":
|
||||
self.runner_params.app_window_params.borderless = True
|
||||
self.runner_params.app_window_params.borderless_closable = False
|
||||
|
||||
Reference in New Issue
Block a user