1 /*
2 * Copyright (c) 2016, 2018, 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 *
71 _usage._archive_region_count++;
72 } else if (r->is_survivor()) {
73 _usage._survivor_used += r->used();
74 _usage._survivor_region_count++;
75 } else if (r->is_eden()) {
76 _usage._eden_used += r->used();
77 _usage._eden_region_count++;
78 } else if (r->is_humongous()) {
79 _usage._humongous_used += r->used();
80 _usage._humongous_region_count++;
81 } else {
82 assert(r->used() == 0, "Expected used to be 0 but it was " SIZE_FORMAT, r->used());
83 }
84 return false;
85 }
86 };
87
88 void G1HeapTransition::print() {
89 Data after(_g1_heap);
90
91 size_t eden_capacity_length_after_gc = _g1_heap->g1_policy()->young_list_target_length() - after._survivor_length;
92 size_t survivor_capacity_length_before_gc = _g1_heap->g1_policy()->max_survivor_regions();
93
94 DetailedUsage usage;
95 if (log_is_enabled(Trace, gc, heap)) {
96 DetailedUsageClosure blk;
97 _g1_heap->heap_region_iterate(&blk);
98 usage = blk._usage;
99 assert(usage._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage._eden_region_count);
100 assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT,
101 after._survivor_length, usage._survivor_region_count);
102 assert(usage._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT,
103 after._old_length, usage._old_region_count);
104 assert(usage._archive_region_count == after._archive_length, "Expected archive to be " SIZE_FORMAT " but was " SIZE_FORMAT,
105 after._archive_length, usage._archive_region_count);
106 assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT,
107 after._humongous_length, usage._humongous_region_count);
108 }
109
110 log_info(gc, heap)("Eden regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
111 _before._eden_length, after._eden_length, eden_capacity_length_after_gc);
112 log_trace(gc, heap)(" Used: 0K, Waste: 0K");
|
1 /*
2 * Copyright (c) 2016, 2019, 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 *
71 _usage._archive_region_count++;
72 } else if (r->is_survivor()) {
73 _usage._survivor_used += r->used();
74 _usage._survivor_region_count++;
75 } else if (r->is_eden()) {
76 _usage._eden_used += r->used();
77 _usage._eden_region_count++;
78 } else if (r->is_humongous()) {
79 _usage._humongous_used += r->used();
80 _usage._humongous_region_count++;
81 } else {
82 assert(r->used() == 0, "Expected used to be 0 but it was " SIZE_FORMAT, r->used());
83 }
84 return false;
85 }
86 };
87
88 void G1HeapTransition::print() {
89 Data after(_g1_heap);
90
91 size_t eden_capacity_length_after_gc = _g1_heap->policy()->young_list_target_length() - after._survivor_length;
92 size_t survivor_capacity_length_before_gc = _g1_heap->policy()->max_survivor_regions();
93
94 DetailedUsage usage;
95 if (log_is_enabled(Trace, gc, heap)) {
96 DetailedUsageClosure blk;
97 _g1_heap->heap_region_iterate(&blk);
98 usage = blk._usage;
99 assert(usage._eden_region_count == 0, "Expected no eden regions, but got " SIZE_FORMAT, usage._eden_region_count);
100 assert(usage._survivor_region_count == after._survivor_length, "Expected survivors to be " SIZE_FORMAT " but was " SIZE_FORMAT,
101 after._survivor_length, usage._survivor_region_count);
102 assert(usage._old_region_count == after._old_length, "Expected old to be " SIZE_FORMAT " but was " SIZE_FORMAT,
103 after._old_length, usage._old_region_count);
104 assert(usage._archive_region_count == after._archive_length, "Expected archive to be " SIZE_FORMAT " but was " SIZE_FORMAT,
105 after._archive_length, usage._archive_region_count);
106 assert(usage._humongous_region_count == after._humongous_length, "Expected humongous to be " SIZE_FORMAT " but was " SIZE_FORMAT,
107 after._humongous_length, usage._humongous_region_count);
108 }
109
110 log_info(gc, heap)("Eden regions: " SIZE_FORMAT "->" SIZE_FORMAT "(" SIZE_FORMAT ")",
111 _before._eden_length, after._eden_length, eden_capacity_length_after_gc);
112 log_trace(gc, heap)(" Used: 0K, Waste: 0K");
|