Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/services/g1MemoryPool.cpp
32285 views
/*1* Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "gc_implementation/g1/g1CollectedHeap.hpp"26#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"27#include "gc_implementation/g1/g1CollectorPolicy.hpp"28#include "gc_implementation/g1/heapRegion.hpp"29#include "services/g1MemoryPool.hpp"3031G1MemoryPoolSuper::G1MemoryPoolSuper(G1CollectedHeap* g1h,32const char* name,33size_t init_size,34size_t max_size,35bool support_usage_threshold) :36_g1mm(g1h->g1mm()), CollectedMemoryPool(name,37MemoryPool::Heap,38init_size,39max_size,40support_usage_threshold) {41assert(UseG1GC, "sanity");42}4344G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) :45G1MemoryPoolSuper(g1h,46"G1 Eden Space",47g1h->g1mm()->eden_space_committed(), /* init_size */48_undefined_max,49false /* support_usage_threshold */) { }5051MemoryUsage G1EdenPool::get_memory_usage() {52size_t initial_sz = initial_size();53size_t max_sz = max_size();54size_t used = used_in_bytes();55size_t committed = _g1mm->eden_space_committed();5657return MemoryUsage(initial_sz, used, committed, max_sz);58}5960G1SurvivorPool::G1SurvivorPool(G1CollectedHeap* g1h) :61G1MemoryPoolSuper(g1h,62"G1 Survivor Space",63g1h->g1mm()->survivor_space_committed(), /* init_size */64_undefined_max,65false /* support_usage_threshold */) { }6667MemoryUsage G1SurvivorPool::get_memory_usage() {68size_t initial_sz = initial_size();69size_t max_sz = max_size();70size_t used = used_in_bytes();71size_t committed = _g1mm->survivor_space_committed();7273return MemoryUsage(initial_sz, used, committed, max_sz);74}7576G1OldGenPool::G1OldGenPool(G1CollectedHeap* g1h) :77G1MemoryPoolSuper(g1h,78"G1 Old Gen",79g1h->g1mm()->old_space_committed(), /* init_size */80g1h->g1mm()->old_gen_max(),81true /* support_usage_threshold */) { }8283MemoryUsage G1OldGenPool::get_memory_usage() {84size_t initial_sz = initial_size();85size_t max_sz = max_size();86size_t used = used_in_bytes();87size_t committed = _g1mm->old_space_committed();8889return MemoryUsage(initial_sz, used, committed, max_sz);90}919293