MCPcopy Create free account
hub / github.com/esengine/esengine / getStats

Method getStats

packages/core/src/Plugins/DebugPlugin.ts:173–199  ·  view source on GitHub ↗

* 获取当前 ECS 统计信息

()

Source from the content-addressed store, hash-verified

171 * 获取当前 ECS 统计信息
172 */
173 public getStats(): ECSDebugStats {
174 if (!this.worldManager) {
175 throw new Error('Plugin not installed');
176 }
177
178 const scenes: SceneDebugInfo[] = [];
179 let totalEntities = 0;
180 let totalSystems = 0;
181
182 const worlds = this.worldManager.getAllWorlds();
183
184 for (const world of worlds) {
185 for (const scene of world.getAllScenes()) {
186 const sceneInfo = this.getSceneInfo(scene);
187 scenes.push(sceneInfo);
188 totalEntities += sceneInfo.entityCount;
189 totalSystems += sceneInfo.systems.length;
190 }
191 }
192
193 return {
194 scenes,
195 totalEntities,
196 totalSystems,
197 timestamp: Date.now()
198 };
199 }
200
201 /**
202 * 获取场景调试信息

Callers 2

logStatsMethod · 0.95
exportJSONMethod · 0.95

Calls 5

getSceneInfoMethod · 0.95
nowMethod · 0.80
pushMethod · 0.65
getAllWorldsMethod · 0.45
getAllScenesMethod · 0.45

Tested by

no test coverage detected