1 /*
2 * Copyright 2015 The Netty Project
3 *
4 * The Netty Project licenses this file to you under the Apache License,
5 * version 2.0 (the "License"); you may not use this file except in compliance
6 * with the License. You may obtain a copy of the License at:
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations
14 * under the License.
15 */
16
17 package io.netty.buffer;
18
19 import java.util.List;
20
21 /**
22 * Expose metrics for an arena.
23 */
24 public interface PoolArenaMetric extends SizeClassesMetric {
25
26 /**
27 * Returns the number of thread caches backed by this arena.
28 */
29 int numThreadCaches();
30
31 /**
32 * Returns the number of tiny sub-pages for the arena.
33 *
34 * @deprecated Tiny sub-pages have been merged into small sub-pages.
35 */
36 @Deprecated
37 int numTinySubpages();
38
39 /**
40 * Returns the number of small sub-pages for the arena.
41 */
42 int numSmallSubpages();
43
44 /**
45 * Returns the number of chunk lists for the arena.
46 */
47 int numChunkLists();
48
49 /**
50 * Returns an unmodifiable {@link List} which holds {@link PoolSubpageMetric}s for tiny sub-pages.
51 *
52 * @deprecated Tiny sub-pages have been merged into small sub-pages.
53 */
54 @Deprecated
55 List<PoolSubpageMetric> tinySubpages();
56
57 /**
58 * Returns an unmodifiable {@link List} which holds {@link PoolSubpageMetric}s for small sub-pages.
59 */
60 List<PoolSubpageMetric> smallSubpages();
61
62 /**
63 * Returns an unmodifiable {@link List} which holds {@link PoolChunkListMetric}s.
64 */
65 List<PoolChunkListMetric> chunkLists();
66
67 /**
68 * Return the number of allocations done via the arena. This includes all sizes.
69 */
70 long numAllocations();
71
72 /**
73 * Return the number of tiny allocations done via the arena.
74 *
75 * @deprecated Tiny allocations have been merged into small allocations.
76 */
77 @Deprecated
78 long numTinyAllocations();
79
80 /**
81 * Return the number of small allocations done via the arena.
82 */
83 long numSmallAllocations();
84
85 /**
86 * Return the number of normal allocations done via the arena.
87 */
88 long numNormalAllocations();
89
90 /**
91 * Return the number of huge allocations done via the arena.
92 */
93 long numHugeAllocations();
94
95 /**
96 * Return the number of chunks allocations done via the arena, or -1 if not defined.
97 */
98 default long numChunkAllocations() {
99 return -1;
100 }
101
102 /**
103 * Return the number of deallocations done via the arena. This includes all sizes.
104 */
105 long numDeallocations();
106
107 /**
108 * Return the number of tiny deallocations done via the arena.
109 *
110 * @deprecated Tiny deallocations have been merged into small deallocations.
111 */
112 @Deprecated
113 long numTinyDeallocations();
114
115 /**
116 * Return the number of small deallocations done via the arena.
117 */
118 long numSmallDeallocations();
119
120 /**
121 * Return the number of normal deallocations done via the arena.
122 */
123 long numNormalDeallocations();
124
125 /**
126 * Return the number of huge deallocations done via the arena.
127 */
128 long numHugeDeallocations();
129
130 /**
131 * Return the number of chunk deallocations done via the arena, or -1 if nor defined.
132 */
133 default long numChunkDeallocations() {
134 return -1;
135 }
136
137 /**
138 * Return the number of currently active allocations.
139 */
140 long numActiveAllocations();
141
142 /**
143 * Return the number of currently active tiny allocations.
144 *
145 * @deprecated Tiny allocations have been merged into small allocations.
146 */
147 @Deprecated
148 long numActiveTinyAllocations();
149
150 /**
151 * Return the number of currently active small allocations.
152 */
153 long numActiveSmallAllocations();
154
155 /**
156 * Return the number of currently active normal allocations.
157 */
158 long numActiveNormalAllocations();
159
160 /**
161 * Return the number of currently active huge allocations.
162 */
163 long numActiveHugeAllocations();
164
165 /**
166 * Return the number of currently active chunks, or -1 if not defined
167 */
168 default long numActiveChunks() {
169 return -1;
170 }
171
172 /**
173 * Return the number of active bytes that are currently allocated by the arena.
174 */
175 long numActiveBytes();
176 }