src/share/vm/services/g1MemoryPool.cpp

Fri, 01 Feb 2013 23:48:08 +0100

author
ctornqvi
date
Fri, 01 Feb 2013 23:48:08 +0100
changeset 4512
4102b59539ce
parent 4153
b9a9ed0f8eeb
child 6876
710a3c8b516e
permissions
-rw-r--r--

8005012: Add WB APIs to better support NMT testing
Summary: Add WB API functions to enable better NMT testing
Reviewed-by: dholmes, zgu

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

mercurial