1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package io.netty.buffer;
17
18 import io.netty.util.internal.StringUtil;
19
20 import java.util.List;
21
22
23
24
25 @SuppressWarnings("deprecation")
26 public final class PooledByteBufAllocatorMetric implements ByteBufAllocatorMetric {
27
28 private final PooledByteBufAllocator allocator;
29
30 PooledByteBufAllocatorMetric(PooledByteBufAllocator allocator) {
31 this.allocator = allocator;
32 }
33
34
35
36
37 public int numHeapArenas() {
38 return allocator.numHeapArenas();
39 }
40
41
42
43
44 public int numDirectArenas() {
45 return allocator.numDirectArenas();
46 }
47
48
49
50
51 public List<PoolArenaMetric> heapArenas() {
52 return allocator.heapArenas();
53 }
54
55
56
57
58 public List<PoolArenaMetric> directArenas() {
59 return allocator.directArenas();
60 }
61
62
63
64
65 public int numThreadLocalCaches() {
66 return allocator.numThreadLocalCaches();
67 }
68
69
70
71
72 public int tinyCacheSize() {
73 return allocator.tinyCacheSize();
74 }
75
76
77
78
79 public int smallCacheSize() {
80 return allocator.smallCacheSize();
81 }
82
83
84
85
86 public int normalCacheSize() {
87 return allocator.normalCacheSize();
88 }
89
90
91
92
93 public int chunkSize() {
94 return allocator.chunkSize();
95 }
96
97 @Override
98 public long usedHeapMemory() {
99 return allocator.usedHeapMemory();
100 }
101
102 @Override
103 public long usedDirectMemory() {
104 return allocator.usedDirectMemory();
105 }
106
107 @Override
108 public String toString() {
109 StringBuilder sb = new StringBuilder(256);
110 sb.append(StringUtil.simpleClassName(this))
111 .append("(usedHeapMemory: ").append(usedHeapMemory())
112 .append("; usedDirectMemory: ").append(usedDirectMemory())
113 .append("; numHeapArenas: ").append(numHeapArenas())
114 .append("; numDirectArenas: ").append(numDirectArenas())
115 .append("; tinyCacheSize: ").append(tinyCacheSize())
116 .append("; smallCacheSize: ").append(smallCacheSize())
117 .append("; normalCacheSize: ").append(normalCacheSize())
118 .append("; numThreadLocalCaches: ").append(numThreadLocalCaches())
119 .append("; chunkSize: ").append(chunkSize()).append(')');
120 return sb.toString();
121 }
122 }