mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-30 21:33:29 +00:00
Implement worker metrics and debugging events
- Introduced WorkerMetricsEvent and SetWorkerDebugEvent to facilitate communication between the main thread and worker for performance monitoring. - Enhanced ClientGameRunner to emit worker metrics and handle debug configuration updates. - Updated PerformanceOverlay to display worker metrics and allow toggling of debug settings. - Refactored Canvas2DRendererProxy and TerritoryRendererProxy to improve rendering performance and manage render cooldowns. - Added profiling capabilities in Worker.worker.ts to track event loop lag, simulation delays, and message handling metrics.
This commit is contained in:
@@ -2,6 +2,7 @@ import { EventBus, GameEvent } from "../core/EventBus";
|
||||
import { UnitType } from "../core/game/Game";
|
||||
import { UnitView } from "../core/game/GameView";
|
||||
import { UserSettings } from "../core/game/UserSettings";
|
||||
import type { WorkerMetricsMessage } from "../core/worker/WorkerMessages";
|
||||
import { UIState } from "./graphics/UIState";
|
||||
import { ReplaySpeedMultiplier } from "./utilities/ReplaySpeedMultiplier";
|
||||
|
||||
@@ -81,6 +82,20 @@ export class RefreshGraphicsEvent implements GameEvent {}
|
||||
|
||||
export class TogglePerformanceOverlayEvent implements GameEvent {}
|
||||
|
||||
export class SetWorkerDebugEvent implements GameEvent {
|
||||
constructor(
|
||||
public readonly config: {
|
||||
enabled: boolean;
|
||||
intervalMs?: number;
|
||||
includeTrace?: boolean;
|
||||
},
|
||||
) {}
|
||||
}
|
||||
|
||||
export class WorkerMetricsEvent implements GameEvent {
|
||||
constructor(public readonly metrics: WorkerMetricsMessage) {}
|
||||
}
|
||||
|
||||
export class ToggleStructureEvent implements GameEvent {
|
||||
constructor(public readonly structureTypes: UnitType[] | null) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user