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/cms/cmsLockVerifier.hpp"
27 #include "gc/cms/compactibleFreeListSpace.hpp"
28 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
29 #include "gc/cms/concurrentMarkSweepThread.hpp"
30 #include "gc/shared/blockOffsetTable.inline.hpp"
31 #include "gc/shared/collectedHeap.inline.hpp"
32 #include "gc/shared/genCollectedHeap.hpp"
33 #include "gc/shared/space.inline.hpp"
34 #include "gc/shared/spaceDecorator.hpp"
35 #include "memory/allocation.inline.hpp"
36 #include "memory/resourceArea.hpp"
37 #include "memory/universe.inline.hpp"
38 #include "oops/oop.inline.hpp"
39 #include "runtime/globals.hpp"
40 #include "runtime/handles.inline.hpp"
41 #include "runtime/init.hpp"
42 #include "runtime/java.hpp"
43 #include "runtime/orderAccess.inline.hpp"
44 #include "runtime/vmThread.hpp"
45 #include "utilities/copy.hpp"
46
47 /////////////////////////////////////////////////////////////////////////
48 //// CompactibleFreeListSpace
49 /////////////////////////////////////////////////////////////////////////
50
51 // highest ranked free list lock rank
52 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3;
53
54 // Defaults are 0 so things will break badly if incorrectly initialized.
488
489 st->print_cr("===========================");
490 st->print_cr("Order of Indexed Free Lists");
491 st->print_cr("=========================");
492 print_indexed_free_lists(st);
493
494 st->print_cr("=================================");
495 st->print_cr("Order of Free Lists in Dictionary");
496 st->print_cr("=================================");
497 print_dictionary_free_lists(st);
498 }
499
500
501 void CompactibleFreeListSpace::reportFreeListStatistics(const char* title) const {
502 assert_lock_strong(&_freelistLock);
503 Log(gc, freelist, stats) log;
504 if (!log.is_debug()) {
505 return;
506 }
507 log.debug("%s", title);
508 _dictionary->report_statistics(log.debug_stream());
509 if (log.is_trace()) {
510 ResourceMark rm;
511 reportIndexedFreeListStatistics(log.trace_stream());
512 size_t total_size = totalSizeInIndexedFreeLists() +
513 _dictionary->total_chunk_size(DEBUG_ONLY(freelistLock()));
514 log.trace(" free=" SIZE_FORMAT " frag=%1.4f", total_size, flsFrag());
515 }
516 }
517
518 void CompactibleFreeListSpace::reportIndexedFreeListStatistics(outputStream* st) const {
519 assert_lock_strong(&_freelistLock);
520 st->print_cr("Statistics for IndexedFreeLists:");
521 st->print_cr("--------------------------------");
522 size_t total_size = totalSizeInIndexedFreeLists();
523 size_t free_blocks = numFreeBlocksInIndexedFreeLists();
524 st->print_cr("Total Free Space: " SIZE_FORMAT, total_size);
525 st->print_cr("Max Chunk Size: " SIZE_FORMAT, maxChunkSizeInIndexedFreeLists());
526 st->print_cr("Number of Blocks: " SIZE_FORMAT, free_blocks);
527 if (free_blocks != 0) {
528 st->print_cr("Av. Block Size: " SIZE_FORMAT, total_size/free_blocks);
|
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/cms/cmsLockVerifier.hpp"
27 #include "gc/cms/compactibleFreeListSpace.hpp"
28 #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp"
29 #include "gc/cms/concurrentMarkSweepThread.hpp"
30 #include "gc/shared/blockOffsetTable.inline.hpp"
31 #include "gc/shared/collectedHeap.inline.hpp"
32 #include "gc/shared/genCollectedHeap.hpp"
33 #include "gc/shared/space.inline.hpp"
34 #include "gc/shared/spaceDecorator.hpp"
35 #include "logging/logStream.inline.hpp"
36 #include "memory/allocation.inline.hpp"
37 #include "memory/resourceArea.hpp"
38 #include "memory/universe.inline.hpp"
39 #include "oops/oop.inline.hpp"
40 #include "runtime/globals.hpp"
41 #include "runtime/handles.inline.hpp"
42 #include "runtime/init.hpp"
43 #include "runtime/java.hpp"
44 #include "runtime/orderAccess.inline.hpp"
45 #include "runtime/vmThread.hpp"
46 #include "utilities/copy.hpp"
47
48 /////////////////////////////////////////////////////////////////////////
49 //// CompactibleFreeListSpace
50 /////////////////////////////////////////////////////////////////////////
51
52 // highest ranked free list lock rank
53 int CompactibleFreeListSpace::_lockRank = Mutex::leaf + 3;
54
55 // Defaults are 0 so things will break badly if incorrectly initialized.
489
490 st->print_cr("===========================");
491 st->print_cr("Order of Indexed Free Lists");
492 st->print_cr("=========================");
493 print_indexed_free_lists(st);
494
495 st->print_cr("=================================");
496 st->print_cr("Order of Free Lists in Dictionary");
497 st->print_cr("=================================");
498 print_dictionary_free_lists(st);
499 }
500
501
502 void CompactibleFreeListSpace::reportFreeListStatistics(const char* title) const {
503 assert_lock_strong(&_freelistLock);
504 Log(gc, freelist, stats) log;
505 if (!log.is_debug()) {
506 return;
507 }
508 log.debug("%s", title);
509
510 LogStream out(log.debug());
511 _dictionary->report_statistics(&out);
512
513 if (log.is_trace()) {
514 ResourceMark rm;
515 reportIndexedFreeListStatistics(log.trace_stream());
516 size_t total_size = totalSizeInIndexedFreeLists() +
517 _dictionary->total_chunk_size(DEBUG_ONLY(freelistLock()));
518 log.trace(" free=" SIZE_FORMAT " frag=%1.4f", total_size, flsFrag());
519 }
520 }
521
522 void CompactibleFreeListSpace::reportIndexedFreeListStatistics(outputStream* st) const {
523 assert_lock_strong(&_freelistLock);
524 st->print_cr("Statistics for IndexedFreeLists:");
525 st->print_cr("--------------------------------");
526 size_t total_size = totalSizeInIndexedFreeLists();
527 size_t free_blocks = numFreeBlocksInIndexedFreeLists();
528 st->print_cr("Total Free Space: " SIZE_FORMAT, total_size);
529 st->print_cr("Max Chunk Size: " SIZE_FORMAT, maxChunkSizeInIndexedFreeLists());
530 st->print_cr("Number of Blocks: " SIZE_FORMAT, free_blocks);
531 if (free_blocks != 0) {
532 st->print_cr("Av. Block Size: " SIZE_FORMAT, total_size/free_blocks);
|