1 /*
2 * Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 class AllocationStats VALUE_OBJ_CLASS_SPEC {
26 // A duration threshold (in ms) used to filter
27 // possibly unreliable samples.
28 static float _threshold;
29
30 // We measure the demand between the end of the previous sweep and
31 // beginning of this sweep:
32 // Count(end_last_sweep) - Count(start_this_sweep)
33 // + splitBirths(between) - splitDeaths(between)
34 // The above number divided by the time since the end of the
35 // previous sweep gives us a time rate of demand for blocks
36 // of this size. We compute a padded average of this rate as
37 // our current estimate for the time rate of demand for blocks
38 // of this size. Similarly, we keep a padded average for the time
39 // between sweeps. Our current estimate for demand for blocks of
40 // this size is then simply computed as the product of these two
41 // estimates.
42 AdaptivePaddedAverage _demand_rate_estimate;
43
44 ssize_t _desired; // Demand stimate computed as described above
140 void set_coalBirths(ssize_t v) { _coalBirths = v; }
141 void increment_coalBirths() { _coalBirths++; }
142
143 ssize_t coalDeaths() const { return _coalDeaths; }
144 void set_coalDeaths(ssize_t v) { _coalDeaths = v; }
145 void increment_coalDeaths() { _coalDeaths++; }
146
147 ssize_t splitBirths() const { return _splitBirths; }
148 void set_splitBirths(ssize_t v) { _splitBirths = v; }
149 void increment_splitBirths() { _splitBirths++; }
150
151 ssize_t splitDeaths() const { return _splitDeaths; }
152 void set_splitDeaths(ssize_t v) { _splitDeaths = v; }
153 void increment_splitDeaths() { _splitDeaths++; }
154
155 NOT_PRODUCT(
156 size_t returnedBytes() const { return _returnedBytes; }
157 void set_returnedBytes(size_t v) { _returnedBytes = v; }
158 )
159 };
|
1 /*
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_ALLOCATIONSTATS_HPP
26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_ALLOCATIONSTATS_HPP
27
28 #ifndef SERIALGC
29 #include "gc_implementation/shared/gcUtil.hpp"
30 #include "memory/allocation.hpp"
31 #include "utilities/globalDefinitions.hpp"
32 #endif
33
34 class AllocationStats VALUE_OBJ_CLASS_SPEC {
35 // A duration threshold (in ms) used to filter
36 // possibly unreliable samples.
37 static float _threshold;
38
39 // We measure the demand between the end of the previous sweep and
40 // beginning of this sweep:
41 // Count(end_last_sweep) - Count(start_this_sweep)
42 // + splitBirths(between) - splitDeaths(between)
43 // The above number divided by the time since the end of the
44 // previous sweep gives us a time rate of demand for blocks
45 // of this size. We compute a padded average of this rate as
46 // our current estimate for the time rate of demand for blocks
47 // of this size. Similarly, we keep a padded average for the time
48 // between sweeps. Our current estimate for demand for blocks of
49 // this size is then simply computed as the product of these two
50 // estimates.
51 AdaptivePaddedAverage _demand_rate_estimate;
52
53 ssize_t _desired; // Demand stimate computed as described above
149 void set_coalBirths(ssize_t v) { _coalBirths = v; }
150 void increment_coalBirths() { _coalBirths++; }
151
152 ssize_t coalDeaths() const { return _coalDeaths; }
153 void set_coalDeaths(ssize_t v) { _coalDeaths = v; }
154 void increment_coalDeaths() { _coalDeaths++; }
155
156 ssize_t splitBirths() const { return _splitBirths; }
157 void set_splitBirths(ssize_t v) { _splitBirths = v; }
158 void increment_splitBirths() { _splitBirths++; }
159
160 ssize_t splitDeaths() const { return _splitDeaths; }
161 void set_splitDeaths(ssize_t v) { _splitDeaths = v; }
162 void increment_splitDeaths() { _splitDeaths++; }
163
164 NOT_PRODUCT(
165 size_t returnedBytes() const { return _returnedBytes; }
166 void set_returnedBytes(size_t v) { _returnedBytes = v; }
167 )
168 };
169
170 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ALLOCATIONSTATS_HPP
|