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  
73  
74      @Deprecated
75      public int tinyCacheSize() {
76          return allocator.tinyCacheSize();
77      }
78  
79      
80  
81  
82      public int smallCacheSize() {
83          return allocator.smallCacheSize();
84      }
85  
86      
87  
88  
89      public int normalCacheSize() {
90          return allocator.normalCacheSize();
91      }
92  
93      
94  
95  
96      public int chunkSize() {
97          return allocator.chunkSize();
98      }
99  
100     @Override
101     public long usedHeapMemory() {
102         return allocator.usedHeapMemory();
103     }
104 
105     @Override
106     public long usedDirectMemory() {
107         return allocator.usedDirectMemory();
108     }
109 
110     @Override
111     public String toString() {
112         StringBuilder sb = new StringBuilder(256);
113         sb.append(StringUtil.simpleClassName(this))
114                 .append("(usedHeapMemory: ").append(usedHeapMemory())
115                 .append("; usedDirectMemory: ").append(usedDirectMemory())
116                 .append("; numHeapArenas: ").append(numHeapArenas())
117                 .append("; numDirectArenas: ").append(numDirectArenas())
118                 .append("; smallCacheSize: ").append(smallCacheSize())
119                 .append("; normalCacheSize: ").append(normalCacheSize())
120                 .append("; numThreadLocalCaches: ").append(numThreadLocalCaches())
121                 .append("; chunkSize: ").append(chunkSize()).append(')');
122         return sb.toString();
123     }
124 }