fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
This commit is contained in:
40
docs/api/memory/proxy-allocator/get-stats.md
Normal file
40
docs/api/memory/proxy-allocator/get-stats.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# ProxyAllocator::GetStats
|
||||
|
||||
```cpp
|
||||
const Stats& GetStats() const;
|
||||
```
|
||||
|
||||
返回详细的统计信息结构体引用。包含累计分配、累计释放、峰值分配、分配次数和额外开销。返回 const 引用,无锁开销(内部已有互斥保护)。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** Stats 结构体 const 引用
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Memory/MemoryManager.h>
|
||||
#include <XCEngine/Memory/ProxyAllocator.h>
|
||||
|
||||
IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator();
|
||||
ProxyAllocator proxy(sysAlloc, "FrameData");
|
||||
|
||||
proxy.Allocate(1024);
|
||||
proxy.Allocate(512);
|
||||
proxy.Free(proxy.Allocate(256));
|
||||
|
||||
const ProxyAllocator::Stats& stats = proxy.GetStats();
|
||||
printf("Total allocated: %zu bytes\n", stats.totalAllocated);
|
||||
printf("Total freed: %zu times\n", stats.totalFreed);
|
||||
printf("Peak allocated: %zu bytes\n", stats.peakAllocated);
|
||||
printf("Allocation count: %zu\n", stats.allocationCount);
|
||||
printf("Memory overhead: %zu bytes\n", stats.memoryOverhead);
|
||||
printf("Current in use: %zu bytes\n",
|
||||
stats.totalAllocated - stats.allocationCount * sizeof(/* typical block */ size_t));
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [ProxyAllocator 总览](proxy-allocator.md) - 返回类总览
|
||||
Reference in New Issue
Block a user