src/hotspot/share/code/codeCache.cpp
changeset 49611 973c9504178e
parent 49594 898ef81cbc0e
child 49746 b17256b5c047
equal deleted inserted replaced
49610:6790b1077a3f 49611:973c9504178e
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    24 
    24 
    25 #include "precompiled.hpp"
    25 #include "precompiled.hpp"
    26 #include "aot/aotLoader.hpp"
    26 #include "aot/aotLoader.hpp"
    27 #include "code/codeBlob.hpp"
    27 #include "code/codeBlob.hpp"
    28 #include "code/codeCache.hpp"
    28 #include "code/codeCache.hpp"
       
    29 #include "code/codeHeapState.hpp"
    29 #include "code/compiledIC.hpp"
    30 #include "code/compiledIC.hpp"
    30 #include "code/dependencies.hpp"
    31 #include "code/dependencies.hpp"
    31 #include "code/icBuffer.hpp"
    32 #include "code/icBuffer.hpp"
    32 #include "code/nmethod.hpp"
    33 #include "code/nmethod.hpp"
    33 #include "code/pcDesc.hpp"
    34 #include "code/pcDesc.hpp"
    34 #include "compiler/compileBroker.hpp"
    35 #include "compiler/compileBroker.hpp"
       
    36 #include "logging/log.hpp"
       
    37 #include "logging/logStream.hpp"
    35 #include "memory/allocation.inline.hpp"
    38 #include "memory/allocation.inline.hpp"
    36 #include "memory/iterator.hpp"
    39 #include "memory/iterator.hpp"
    37 #include "memory/resourceArea.hpp"
    40 #include "memory/resourceArea.hpp"
    38 #include "oops/method.inline.hpp"
    41 #include "oops/method.inline.hpp"
    39 #include "oops/objArrayOop.hpp"
    42 #include "oops/objArrayOop.hpp"
  1361     // Dump code cache  into a buffer before locking the tty,
  1364     // Dump code cache  into a buffer before locking the tty,
  1362     {
  1365     {
  1363       MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  1366       MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
  1364       print_summary(&s);
  1367       print_summary(&s);
  1365     }
  1368     }
  1366     ttyLocker ttyl;
  1369     {
  1367     tty->print("%s", s.as_string());
  1370       ttyLocker ttyl;
       
  1371       tty->print("%s", s.as_string());
       
  1372     }
       
  1373 
       
  1374     if (heap->full_count() == 0) {
       
  1375       LogTarget(Debug, codecache) lt;
       
  1376       if (lt.is_enabled()) {
       
  1377         CompileBroker::print_heapinfo(tty, "all", "4096"); // details, may be a lot!
       
  1378       }
       
  1379     }
  1368   }
  1380   }
  1369 
  1381 
  1370   heap->report_full();
  1382   heap->report_full();
  1371 
  1383 
  1372   EventCodeCacheFull event;
  1384   EventCodeCacheFull event;
  1637   st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
  1649   st->print(" total_blobs='" UINT32_FORMAT "' nmethods='" UINT32_FORMAT "'"
  1638             " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
  1650             " adapters='" UINT32_FORMAT "' free_code_cache='" SIZE_FORMAT "'",
  1639             blob_count(), nmethod_count(), adapter_count(),
  1651             blob_count(), nmethod_count(), adapter_count(),
  1640             unallocated_capacity());
  1652             unallocated_capacity());
  1641 }
  1653 }
       
  1654 
       
  1655 //---<  BEGIN  >--- CodeHeap State Analytics.
       
  1656 
       
  1657 void CodeCache::aggregate(outputStream *out, const char* granularity) {
       
  1658   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1659     CodeHeapState::aggregate(out, (*heap), granularity);
       
  1660   }
       
  1661 }
       
  1662 
       
  1663 void CodeCache::discard(outputStream *out) {
       
  1664   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1665     CodeHeapState::discard(out, (*heap));
       
  1666   }
       
  1667 }
       
  1668 
       
  1669 void CodeCache::print_usedSpace(outputStream *out) {
       
  1670   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1671     CodeHeapState::print_usedSpace(out, (*heap));
       
  1672   }
       
  1673 }
       
  1674 
       
  1675 void CodeCache::print_freeSpace(outputStream *out) {
       
  1676   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1677     CodeHeapState::print_freeSpace(out, (*heap));
       
  1678   }
       
  1679 }
       
  1680 
       
  1681 void CodeCache::print_count(outputStream *out) {
       
  1682   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1683     CodeHeapState::print_count(out, (*heap));
       
  1684   }
       
  1685 }
       
  1686 
       
  1687 void CodeCache::print_space(outputStream *out) {
       
  1688   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1689     CodeHeapState::print_space(out, (*heap));
       
  1690   }
       
  1691 }
       
  1692 
       
  1693 void CodeCache::print_age(outputStream *out) {
       
  1694   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1695     CodeHeapState::print_age(out, (*heap));
       
  1696   }
       
  1697 }
       
  1698 
       
  1699 void CodeCache::print_names(outputStream *out) {
       
  1700   FOR_ALL_ALLOCABLE_HEAPS(heap) {
       
  1701     CodeHeapState::print_names(out, (*heap));
       
  1702   }
       
  1703 }
       
  1704 //---<  END  >--- CodeHeap State Analytics.