< prev index next >

src/hotspot/share/services/lowMemoryDetector.cpp

Print this page
rev 56464 : 8231707: Improve Mutex inlining
Contributed-by: robbin.ehn@oracle.com, claes.redestad@oracle.com


  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 "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/interfaceSupport.inline.hpp"
  32 #include "runtime/java.hpp"
  33 #include "runtime/javaCalls.hpp"
  34 #include "runtime/mutex.hpp"
  35 #include "runtime/mutexLocker.hpp"
  36 #include "services/lowMemoryDetector.hpp"
  37 #include "services/management.hpp"
  38 
  39 volatile bool LowMemoryDetector::_enabled_for_collected_pools = false;
  40 volatile jint LowMemoryDetector::_disabled_count = 0;
  41 
  42 bool LowMemoryDetector::has_pending_requests() {
  43   assert(Service_lock->owned_by_self(), "Must own Service_lock");
  44   bool has_requests = false;
  45   int num_memory_pools = MemoryService::num_memory_pools();
  46   for (int i = 0; i < num_memory_pools; i++) {
  47     MemoryPool* pool = MemoryService::get_memory_pool(i);
  48     SensorInfo* sensor = pool->usage_sensor();
  49     if (sensor != NULL) {
  50       has_requests = has_requests || sensor->has_pending_requests();
  51     }
  52 
  53     SensorInfo* gc_sensor = pool->gc_usage_sensor();
  54     if (gc_sensor != NULL) {
  55       has_requests = has_requests || gc_sensor->has_pending_requests();




  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 "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "memory/resourceArea.hpp"
  29 #include "oops/oop.inline.hpp"
  30 #include "runtime/handles.inline.hpp"
  31 #include "runtime/interfaceSupport.inline.hpp"
  32 #include "runtime/java.hpp"
  33 #include "runtime/javaCalls.hpp"
  34 #include "runtime/mutex.hpp"
  35 #include "runtime/mutexLocker.inline.hpp"
  36 #include "services/lowMemoryDetector.hpp"
  37 #include "services/management.hpp"
  38 
  39 volatile bool LowMemoryDetector::_enabled_for_collected_pools = false;
  40 volatile jint LowMemoryDetector::_disabled_count = 0;
  41 
  42 bool LowMemoryDetector::has_pending_requests() {
  43   assert(Service_lock->owned_by_self(), "Must own Service_lock");
  44   bool has_requests = false;
  45   int num_memory_pools = MemoryService::num_memory_pools();
  46   for (int i = 0; i < num_memory_pools; i++) {
  47     MemoryPool* pool = MemoryService::get_memory_pool(i);
  48     SensorInfo* sensor = pool->usage_sensor();
  49     if (sensor != NULL) {
  50       has_requests = has_requests || sensor->has_pending_requests();
  51     }
  52 
  53     SensorInfo* gc_sensor = pool->gc_usage_sensor();
  54     if (gc_sensor != NULL) {
  55       has_requests = has_requests || gc_sensor->has_pending_requests();


< prev index next >