HBASE-23184 The HeapAllocation in WebUI is not accurate (#730)

Signed-off-by: stack <stack@apache.org>
This commit is contained in:
chenxu14 2019-10-31 17:53:24 +08:00 committed by binlijin
parent 2451c2c532
commit 255be63e1d
3 changed files with 10 additions and 2 deletions

View File

@ -254,6 +254,14 @@ public class ByteBuffAllocator {
return maxBufCount;
}
public static long getHeapAllocationBytes(ByteBuffAllocator... allocators) {
long heapAllocBytes = 0;
for (ByteBuffAllocator alloc : Sets.newHashSet(allocators)) {
heapAllocBytes += alloc.getHeapAllocationBytes();
}
return heapAllocBytes;
}
public static double getHeapAllocationRatio(ByteBuffAllocator... allocators) {
double heapDelta = 0.0, poolDelta = 0.0;
long heapAllocBytes, poolAllocBytes;

View File

@ -246,7 +246,7 @@ ByteBuffAllocator bbAllocator;
<th>Buffer Size(Bytes)</th>
</tr>
<tr>
<td><% bbAllocator.getHeapAllocationBytes() %></td>
<td><% ByteBuffAllocator.getHeapAllocationBytes(bbAllocator, ByteBuffAllocator.HEAP) %></td>
<td><% bbAllocator.getPoolAllocationBytes() %></td>
<td><% String.format("%.3f", ByteBuffAllocator.getHeapAllocationRatio(bbAllocator, ByteBuffAllocator.HEAP) * 100) %><% "%" %></td>
<td><% bbAllocator.getTotalBufferCount() %></td>

View File

@ -1010,7 +1010,7 @@ class MetricsRegionServerWrapperImpl
@Override
public long getByteBuffAllocatorHeapAllocationBytes() {
return this.allocator.getHeapAllocationBytes();
return ByteBuffAllocator.getHeapAllocationBytes(allocator, ByteBuffAllocator.HEAP);
}
@Override