1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty5.buffer.api.pool;
17
18 import io.netty5.util.internal.StringUtil;
19
20 import java.util.List;
21
22
23
24
25 final class PooledBufferAllocatorMetric implements BufferAllocatorMetric {
26
27 private final PooledBufferAllocator allocator;
28
29 PooledBufferAllocatorMetric(PooledBufferAllocator allocator) {
30 this.allocator = allocator;
31 }
32
33 @Override
34 public int numArenas() {
35 return allocator.numArenas();
36 }
37
38 @Override
39 public List<PoolArenaMetric> arenaMetrics() {
40 return allocator.arenaMetrics();
41 }
42
43 @Override
44 public int numThreadLocalCaches() {
45 return allocator.numThreadLocalCaches();
46 }
47
48 @Override
49 public int smallCacheSize() {
50 return allocator.smallCacheSize();
51 }
52
53 @Override
54 public int normalCacheSize() {
55 return allocator.normalCacheSize();
56 }
57
58 @Override
59 public int chunkSize() {
60 return allocator.chunkSize();
61 }
62
63 @Override
64 public long usedMemory() {
65 return allocator.usedMemory();
66 }
67
68 @Override
69 public long pinnedMemory() {
70 return allocator.pinnedMemory();
71 }
72
73 @Override
74 public String toString() {
75 StringBuilder sb = new StringBuilder(256);
76 sb.append(StringUtil.simpleClassName(this))
77 .append("(usedMemory: ").append(usedMemory())
78 .append("; pinnedMemory: ").append(pinnedMemory())
79 .append("; numArenas: ").append(numArenas())
80 .append("; smallCacheSize: ").append(smallCacheSize())
81 .append("; normalCacheSize: ").append(normalCacheSize())
82 .append("; numThreadLocalCaches: ").append(numThreadLocalCaches())
83 .append("; chunkSize: ").append(chunkSize()).append(')');
84 return sb.toString();
85 }
86 }