src/share/vm/services/g1MemoryPool.cpp

Wed, 03 Jul 2019 20:42:37 +0800

author
aoqi
date
Wed, 03 Jul 2019 20:42:37 +0800
changeset 9637
eef07cd490d4
parent 6876
710a3c8b516e
permissions
-rw-r--r--

Merge

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@0 25 #include "precompiled.hpp"
aoqi@0 26 #include "gc_implementation/g1/g1CollectedHeap.hpp"
aoqi@0 27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
aoqi@0 28 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
aoqi@0 29 #include "gc_implementation/g1/heapRegion.hpp"
aoqi@0 30 #include "services/g1MemoryPool.hpp"
aoqi@0 31
aoqi@0 32 G1MemoryPoolSuper::G1MemoryPoolSuper(G1CollectedHeap* g1h,
aoqi@0 33 const char* name,
aoqi@0 34 size_t init_size,
aoqi@0 35 size_t max_size,
aoqi@0 36 bool support_usage_threshold) :
aoqi@0 37 _g1mm(g1h->g1mm()), CollectedMemoryPool(name,
aoqi@0 38 MemoryPool::Heap,
aoqi@0 39 init_size,
aoqi@0 40 max_size,
aoqi@0 41 support_usage_threshold) {
aoqi@0 42 assert(UseG1GC, "sanity");
aoqi@0 43 }
aoqi@0 44
aoqi@0 45 G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) :
aoqi@0 46 G1MemoryPoolSuper(g1h,
aoqi@0 47 "G1 Eden Space",
aoqi@0 48 g1h->g1mm()->eden_space_committed(), /* init_size */
aoqi@0 49 _undefined_max,
aoqi@0 50 false /* support_usage_threshold */) { }
aoqi@0 51
aoqi@0 52 MemoryUsage G1EdenPool::get_memory_usage() {
aoqi@0 53 size_t initial_sz = initial_size();
aoqi@0 54 size_t max_sz = max_size();
aoqi@0 55 size_t used = used_in_bytes();
aoqi@0 56 size_t committed = _g1mm->eden_space_committed();
aoqi@0 57
aoqi@0 58 return MemoryUsage(initial_sz, used, committed, max_sz);
aoqi@0 59 }
aoqi@0 60
aoqi@0 61 G1SurvivorPool::G1SurvivorPool(G1CollectedHeap* g1h) :
aoqi@0 62 G1MemoryPoolSuper(g1h,
aoqi@0 63 "G1 Survivor Space",
aoqi@0 64 g1h->g1mm()->survivor_space_committed(), /* init_size */
aoqi@0 65 _undefined_max,
aoqi@0 66 false /* support_usage_threshold */) { }
aoqi@0 67
aoqi@0 68 MemoryUsage G1SurvivorPool::get_memory_usage() {
aoqi@0 69 size_t initial_sz = initial_size();
aoqi@0 70 size_t max_sz = max_size();
aoqi@0 71 size_t used = used_in_bytes();
aoqi@0 72 size_t committed = _g1mm->survivor_space_committed();
aoqi@0 73
aoqi@0 74 return MemoryUsage(initial_sz, used, committed, max_sz);
aoqi@0 75 }
aoqi@0 76
aoqi@0 77 G1OldGenPool::G1OldGenPool(G1CollectedHeap* g1h) :
aoqi@0 78 G1MemoryPoolSuper(g1h,
aoqi@0 79 "G1 Old Gen",
aoqi@0 80 g1h->g1mm()->old_space_committed(), /* init_size */
aoqi@0 81 g1h->g1mm()->old_gen_max(),
aoqi@0 82 true /* support_usage_threshold */) { }
aoqi@0 83
aoqi@0 84 MemoryUsage G1OldGenPool::get_memory_usage() {
aoqi@0 85 size_t initial_sz = initial_size();
aoqi@0 86 size_t max_sz = max_size();
aoqi@0 87 size_t used = used_in_bytes();
aoqi@0 88 size_t committed = _g1mm->old_space_committed();
aoqi@0 89
aoqi@0 90 return MemoryUsage(initial_sz, used, committed, max_sz);
aoqi@0 91 }

mercurial