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 #include "precompiled.hpp"
26 #include "gc/g1/g1EvacStats.hpp"
27 #include "gc/shared/gcId.hpp"
28 #include "trace/tracing.hpp"
29
30 void G1EvacStats::adjust_desired_plab_sz() {
31 if (PrintPLAB) {
32 gclog_or_tty->print(" (allocated = " SIZE_FORMAT " wasted = " SIZE_FORMAT " "
33 "unused = " SIZE_FORMAT " used = " SIZE_FORMAT " "
34 "undo_waste = " SIZE_FORMAT " region_end_waste = " SIZE_FORMAT " "
35 "regions filled = %u direct_allocated = " SIZE_FORMAT " "
36 "failure_used = " SIZE_FORMAT " failure_waste = " SIZE_FORMAT ") ",
37 _allocated, _wasted, _unused, used(), _undo_wasted, _region_end_waste,
38 _regions_filled, _direct_allocated, _failure_used, _failure_waste);
39 }
40
41 if (ResizePLAB) {
42
43 assert(is_object_aligned(max_size()) && min_size() <= max_size(),
44 "PLAB clipping computation may be incorrect");
45
97 // Take historical weighted average
98 _filter.sample(cur_plab_sz);
99 // Clip from above and below, and align to object boundary
100 size_t plab_sz;
101 plab_sz = MAX2(min_size(), (size_t)_filter.average());
102 plab_sz = MIN2(max_size(), plab_sz);
103 plab_sz = align_object_size(plab_sz);
104 // Latch the result
105 _desired_net_plab_sz = plab_sz;
106 if (PrintPLAB) {
107 gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " desired_plab_sz = " SIZE_FORMAT ") ", cur_plab_sz, plab_sz);
108 }
109 }
110 if (PrintPLAB) {
111 gclog_or_tty->cr();
112 }
113 // Clear accumulators for next round.
114 reset();
115 }
116
|
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 #include "precompiled.hpp"
26 #include "memory/allocation.inline.hpp"
27 #include "gc/g1/g1EvacStats.hpp"
28 #include "gc/shared/gcId.hpp"
29 #include "trace/tracing.hpp"
30
31 void G1EvacStats::adjust_desired_plab_sz() {
32 if (PrintPLAB) {
33 gclog_or_tty->print(" (allocated = " SIZE_FORMAT " wasted = " SIZE_FORMAT " "
34 "unused = " SIZE_FORMAT " used = " SIZE_FORMAT " "
35 "undo_waste = " SIZE_FORMAT " region_end_waste = " SIZE_FORMAT " "
36 "regions filled = %u direct_allocated = " SIZE_FORMAT " "
37 "failure_used = " SIZE_FORMAT " failure_waste = " SIZE_FORMAT ") ",
38 _allocated, _wasted, _unused, used(), _undo_wasted, _region_end_waste,
39 _regions_filled, _direct_allocated, _failure_used, _failure_waste);
40 }
41
42 if (ResizePLAB) {
43
44 assert(is_object_aligned(max_size()) && min_size() <= max_size(),
45 "PLAB clipping computation may be incorrect");
46
98 // Take historical weighted average
99 _filter.sample(cur_plab_sz);
100 // Clip from above and below, and align to object boundary
101 size_t plab_sz;
102 plab_sz = MAX2(min_size(), (size_t)_filter.average());
103 plab_sz = MIN2(max_size(), plab_sz);
104 plab_sz = align_object_size(plab_sz);
105 // Latch the result
106 _desired_net_plab_sz = plab_sz;
107 if (PrintPLAB) {
108 gclog_or_tty->print(" (plab_sz = " SIZE_FORMAT " desired_plab_sz = " SIZE_FORMAT ") ", cur_plab_sz, plab_sz);
109 }
110 }
111 if (PrintPLAB) {
112 gclog_or_tty->cr();
113 }
114 // Clear accumulators for next round.
115 reset();
116 }
117
118 G1EvacStats::~G1EvacStats() { }
|