Add FastAlloc memory utilization trace. (#5739)
Co-authored-by: Yao Xiao <yaoxiao@Yaos-MacBook-Pro.local>
This commit is contained in:
parent
5066d67dec
commit
c8e6819a10
|
@ -161,6 +161,39 @@ SystemStatistics customSystemMonitor(std::string const& eventName, StatisticsSta
|
|||
.detail("ZoneID", machineState.zoneId)
|
||||
.detail("MachineID", machineState.machineId);
|
||||
|
||||
uint64_t total_memory = 0;
|
||||
total_memory += FastAllocator<16>::getTotalMemory();
|
||||
total_memory += FastAllocator<32>::getTotalMemory();
|
||||
total_memory += FastAllocator<64>::getTotalMemory();
|
||||
total_memory += FastAllocator<96>::getTotalMemory();
|
||||
total_memory += FastAllocator<128>::getTotalMemory();
|
||||
total_memory += FastAllocator<256>::getTotalMemory();
|
||||
total_memory += FastAllocator<512>::getTotalMemory();
|
||||
total_memory += FastAllocator<1024>::getTotalMemory();
|
||||
total_memory += FastAllocator<2048>::getTotalMemory();
|
||||
total_memory += FastAllocator<4096>::getTotalMemory();
|
||||
total_memory += FastAllocator<8192>::getTotalMemory();
|
||||
|
||||
uint64_t unused_memory = 0;
|
||||
unused_memory += FastAllocator<16>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<32>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<64>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<96>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<128>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<256>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<512>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<1024>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<2048>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<4096>::getApproximateMemoryUnused();
|
||||
unused_memory += FastAllocator<8192>::getApproximateMemoryUnused();
|
||||
|
||||
if (total_memory > 0) {
|
||||
TraceEvent("FastAllocMemoryUsage")
|
||||
.detail("TotalMemory", total_memory)
|
||||
.detail("UnusedMemory", unused_memory)
|
||||
.detail("Utilization", format("%f%%", (total_memory - unused_memory) * 100.0 / total_memory));
|
||||
}
|
||||
|
||||
TraceEvent n("NetworkMetrics");
|
||||
n.detail("Elapsed", currentStats.elapsed)
|
||||
.detail("CantSleep", netData.countCantSleep - statState->networkState.countCantSleep)
|
||||
|
|
Loading…
Reference in New Issue