1 /*
2 * Copyright (c) 2001, 2014, 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 #include "utilities/macros.hpp"
29 #include "memory/allocation.hpp"
30 #include "utilities/globalDefinitions.hpp"
31 #include "gc_implementation/shared/gcUtil.hpp"
32
33 class AllocationStats VALUE_OBJ_CLASS_SPEC {
34 // A duration threshold (in ms) used to filter
35 // possibly unreliable samples.
36 static float _threshold;
37
38 // We measure the demand between the end of the previous sweep and
39 // beginning of this sweep:
40 // Count(end_last_sweep) - Count(start_this_sweep)
41 // + split_births(between) - split_deaths(between)
42 // The above number divided by the time since the end of the
43 // previous sweep gives us a time rate of demand for blocks
44 // of this size. We compute a padded average of this rate as
45 // our current estimate for the time rate of demand for blocks
46 // of this size. Similarly, we keep a padded average for the time
47 // between sweeps. Our current estimate for demand for blocks of
48 // this size is then simply computed as the product of these two
49 // estimates.
50 AdaptivePaddedAverage _demand_rate_estimate;
51
150 void increment_coal_births() { _coal_births++; }
151
152 ssize_t coal_deaths() const { return _coal_deaths; }
153 void set_coal_deaths(ssize_t v) { _coal_deaths = v; }
154 void increment_coal_deaths() { _coal_deaths++; }
155
156 ssize_t split_births() const { return _split_births; }
157 void set_split_births(ssize_t v) { _split_births = v; }
158 void increment_split_births() { _split_births++; }
159
160 ssize_t split_deaths() const { return _split_deaths; }
161 void set_split_deaths(ssize_t v) { _split_deaths = v; }
162 void increment_split_deaths() { _split_deaths++; }
163
164 NOT_PRODUCT(
165 size_t returned_bytes() const { return _returned_bytes; }
166 void set_returned_bytes(size_t v) { _returned_bytes = v; }
167 )
168 };
169
170 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_ALLOCATIONSTATS_HPP
|
1 /*
2 * Copyright (c) 2001, 2015, 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_CMS_ALLOCATIONSTATS_HPP
26 #define SHARE_VM_GC_CMS_ALLOCATIONSTATS_HPP
27
28 #include "gc/shared/gcUtil.hpp"
29 #include "memory/allocation.hpp"
30 #include "utilities/globalDefinitions.hpp"
31 #include "utilities/macros.hpp"
32
33 class AllocationStats VALUE_OBJ_CLASS_SPEC {
34 // A duration threshold (in ms) used to filter
35 // possibly unreliable samples.
36 static float _threshold;
37
38 // We measure the demand between the end of the previous sweep and
39 // beginning of this sweep:
40 // Count(end_last_sweep) - Count(start_this_sweep)
41 // + split_births(between) - split_deaths(between)
42 // The above number divided by the time since the end of the
43 // previous sweep gives us a time rate of demand for blocks
44 // of this size. We compute a padded average of this rate as
45 // our current estimate for the time rate of demand for blocks
46 // of this size. Similarly, we keep a padded average for the time
47 // between sweeps. Our current estimate for demand for blocks of
48 // this size is then simply computed as the product of these two
49 // estimates.
50 AdaptivePaddedAverage _demand_rate_estimate;
51
150 void increment_coal_births() { _coal_births++; }
151
152 ssize_t coal_deaths() const { return _coal_deaths; }
153 void set_coal_deaths(ssize_t v) { _coal_deaths = v; }
154 void increment_coal_deaths() { _coal_deaths++; }
155
156 ssize_t split_births() const { return _split_births; }
157 void set_split_births(ssize_t v) { _split_births = v; }
158 void increment_split_births() { _split_births++; }
159
160 ssize_t split_deaths() const { return _split_deaths; }
161 void set_split_deaths(ssize_t v) { _split_deaths = v; }
162 void increment_split_deaths() { _split_deaths++; }
163
164 NOT_PRODUCT(
165 size_t returned_bytes() const { return _returned_bytes; }
166 void set_returned_bytes(size_t v) { _returned_bytes = v; }
167 )
168 };
169
170 #endif // SHARE_VM_GC_CMS_ALLOCATIONSTATS_HPP
|