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

Method getGlobalStats

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

* 获取总体统计信息 * @returns 总体统计信息

()

Source from the content-addressed store, hash-verified

138 * @returns 总体统计信息
139 */
140 public getGlobalStats(): PoolStats {
141 let totalSize = 0;
142 let totalMaxSize = 0;
143 let totalCreated = 0;
144 let totalObtained = 0;
145 let totalReleased = 0;
146 let totalMemoryUsage = 0;
147
148 for (const pool of this.pools.values()) {
149 const stats = pool.getStats();
150 totalSize += stats.size;
151 totalMaxSize += stats.maxSize;
152 totalCreated += stats.totalCreated;
153 totalObtained += stats.totalObtained;
154 totalReleased += stats.totalReleased;
155 totalMemoryUsage += stats.estimatedMemoryUsage;
156 }
157
158 const hitRate = totalObtained === 0 ? 0 : (totalObtained - totalCreated) / totalObtained;
159
160 return {
161 size: totalSize,
162 maxSize: totalMaxSize,
163 totalCreated,
164 totalObtained,
165 totalReleased,
166 hitRate,
167 estimatedMemoryUsage: totalMemoryUsage
168 };
169 }
170
171 /**
172 * 获取格式化的统计信息字符串

Callers 1

getStatsStringMethod · 0.95

Calls 2

getStatsMethod · 0.65
valuesMethod · 0.45

Tested by

no test coverage detected