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

Method getStatsString

packages/core/src/Utils/Pool/PoolManager.ts:175–199  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

173 * @returns 格式化字符串
174 */
175 public getStatsString(): string {
176 const lines: string[] = ['=== Pool Manager Statistics ===', ''];
177
178 if (this.pools.size === 0) {
179 lines.push('No pools registered');
180 return lines.join('\n');
181 }
182
183 const globalStats = this.getGlobalStats();
184 lines.push(`Total Pools: ${this.pools.size}`);
185 lines.push(`Global Hit Rate: ${(globalStats.hitRate * 100).toFixed(1)}%`);
186 lines.push(`Global Memory Usage: ${(globalStats.estimatedMemoryUsage / 1024).toFixed(1)} KB`);
187 lines.push('');
188
189 for (const [name, pool] of this.pools) {
190 const stats = pool.getStats();
191 lines.push(`${name}:`);
192 lines.push(` Size: ${stats.size}/${stats.maxSize}`);
193 lines.push(` Hit Rate: ${(stats.hitRate * 100).toFixed(1)}%`);
194 lines.push(` Memory: ${(stats.estimatedMemoryUsage / 1024).toFixed(1)} KB`);
195 lines.push('');
196 }
197
198 return lines.join('\n');
199 }
200
201 /**
202 * 设置自动压缩间隔

Callers

nothing calls this directly

Calls 4

getGlobalStatsMethod · 0.95
pushMethod · 0.65
getStatsMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected