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

Method getGlobalStatsString

packages/core/src/Utils/Pool/Pool.ts:242–262  ·  view source on GitHub ↗

* 获取全局池统计信息的格式化字符串 * @returns 格式化的统计信息字符串

()

Source from the content-addressed store, hash-verified

240 * @returns 格式化的统计信息字符串
241 */
242 public static getGlobalStatsString(): string {
243 const stats = this.getAllPoolStats();
244 const lines: string[] = ['=== Object Pool Global Statistics ===', ''];
245
246 if (Object.keys(stats).length === 0) {
247 lines.push('No pools registered');
248 return lines.join('\n');
249 }
250
251 for (const [typeName, stat] of Object.entries(stats)) {
252 lines.push(`${typeName}:`);
253 lines.push(` Size: ${stat.size}/${stat.maxSize}`);
254 lines.push(` Hit Rate: ${(stat.hitRate * 100).toFixed(1)}%`);
255 lines.push(` Total Created: ${stat.totalCreated}`);
256 lines.push(` Total Obtained: ${stat.totalObtained}`);
257 lines.push(` Memory: ${(stat.estimatedMemoryUsage / 1024).toFixed(1)} KB`);
258 lines.push('');
259 }
260
261 return lines.join('\n');
262 }
263
264 /**
265 * 更新命中率

Callers

nothing calls this directly

Calls 5

getAllPoolStatsMethod · 0.95
keysMethod · 0.80
entriesMethod · 0.80
pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected