Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/share/vm/services/psMemoryPool.hpp
32285 views
/*1* Copyright (c) 2007, 2013, 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#ifndef SHARE_VM_SERVICES_PSMEMORYPOOL_HPP25#define SHARE_VM_SERVICES_PSMEMORYPOOL_HPP2627#include "utilities/macros.hpp"28#if INCLUDE_ALL_GCS29#include "gc_implementation/parallelScavenge/psOldGen.hpp"30#include "gc_implementation/parallelScavenge/psYoungGen.hpp"31#include "gc_implementation/shared/mutableSpace.hpp"32#include "memory/defNewGeneration.hpp"33#include "memory/heap.hpp"34#include "memory/space.hpp"35#include "services/memoryPool.hpp"36#include "services/memoryUsage.hpp"37#endif // INCLUDE_ALL_GCS3839class PSGenerationPool : public CollectedMemoryPool {40private:41PSOldGen* _gen;4243public:44PSGenerationPool(PSOldGen* pool, const char* name, PoolType type, bool support_usage_threshold);4546MemoryUsage get_memory_usage();47size_t used_in_bytes() { return _gen->used_in_bytes(); }48size_t max_size() const { return _gen->reserved().byte_size(); }49};5051class EdenMutableSpacePool : public CollectedMemoryPool {52private:53PSYoungGen* _gen;54MutableSpace* _space;5556public:57EdenMutableSpacePool(PSYoungGen* gen,58MutableSpace* space,59const char* name,60PoolType type,61bool support_usage_threshold);6263MutableSpace* space() { return _space; }64MemoryUsage get_memory_usage();65size_t used_in_bytes() { return space()->used_in_bytes(); }66size_t max_size() const {67// Eden's max_size = max_size of Young Gen - the current committed size of survivor spaces68return _gen->max_size() - _gen->from_space()->capacity_in_bytes() - _gen->to_space()->capacity_in_bytes();69}70};7172class SurvivorMutableSpacePool : public CollectedMemoryPool {73private:74PSYoungGen* _gen;7576public:77SurvivorMutableSpacePool(PSYoungGen* gen,78const char* name,79PoolType type,80bool support_usage_threshold);8182MemoryUsage get_memory_usage();8384size_t used_in_bytes() {85return _gen->from_space()->used_in_bytes();86}87size_t committed_in_bytes() {88return _gen->from_space()->capacity_in_bytes();89}90size_t max_size() const {91// Return current committed size of the from-space92return _gen->from_space()->capacity_in_bytes();93}94};9596#endif // SHARE_VM_SERVICES_PSMEMORYPOOL_HPP979899