1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/share/vm/services/g1MemoryPool.cpp Wed Apr 27 01:25:04 2016 +0800 1.3 @@ -0,0 +1,91 @@ 1.4 +/* 1.5 + * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + * 1.26 + */ 1.27 + 1.28 +#include "precompiled.hpp" 1.29 +#include "gc_implementation/g1/g1CollectedHeap.hpp" 1.30 +#include "gc_implementation/g1/g1CollectedHeap.inline.hpp" 1.31 +#include "gc_implementation/g1/g1CollectorPolicy.hpp" 1.32 +#include "gc_implementation/g1/heapRegion.hpp" 1.33 +#include "services/g1MemoryPool.hpp" 1.34 + 1.35 +G1MemoryPoolSuper::G1MemoryPoolSuper(G1CollectedHeap* g1h, 1.36 + const char* name, 1.37 + size_t init_size, 1.38 + size_t max_size, 1.39 + bool support_usage_threshold) : 1.40 + _g1mm(g1h->g1mm()), CollectedMemoryPool(name, 1.41 + MemoryPool::Heap, 1.42 + init_size, 1.43 + max_size, 1.44 + support_usage_threshold) { 1.45 + assert(UseG1GC, "sanity"); 1.46 +} 1.47 + 1.48 +G1EdenPool::G1EdenPool(G1CollectedHeap* g1h) : 1.49 + G1MemoryPoolSuper(g1h, 1.50 + "G1 Eden Space", 1.51 + g1h->g1mm()->eden_space_committed(), /* init_size */ 1.52 + _undefined_max, 1.53 + false /* support_usage_threshold */) { } 1.54 + 1.55 +MemoryUsage G1EdenPool::get_memory_usage() { 1.56 + size_t initial_sz = initial_size(); 1.57 + size_t max_sz = max_size(); 1.58 + size_t used = used_in_bytes(); 1.59 + size_t committed = _g1mm->eden_space_committed(); 1.60 + 1.61 + return MemoryUsage(initial_sz, used, committed, max_sz); 1.62 +} 1.63 + 1.64 +G1SurvivorPool::G1SurvivorPool(G1CollectedHeap* g1h) : 1.65 + G1MemoryPoolSuper(g1h, 1.66 + "G1 Survivor Space", 1.67 + g1h->g1mm()->survivor_space_committed(), /* init_size */ 1.68 + _undefined_max, 1.69 + false /* support_usage_threshold */) { } 1.70 + 1.71 +MemoryUsage G1SurvivorPool::get_memory_usage() { 1.72 + size_t initial_sz = initial_size(); 1.73 + size_t max_sz = max_size(); 1.74 + size_t used = used_in_bytes(); 1.75 + size_t committed = _g1mm->survivor_space_committed(); 1.76 + 1.77 + return MemoryUsage(initial_sz, used, committed, max_sz); 1.78 +} 1.79 + 1.80 +G1OldGenPool::G1OldGenPool(G1CollectedHeap* g1h) : 1.81 + G1MemoryPoolSuper(g1h, 1.82 + "G1 Old Gen", 1.83 + g1h->g1mm()->old_space_committed(), /* init_size */ 1.84 + g1h->g1mm()->old_gen_max(), 1.85 + true /* support_usage_threshold */) { } 1.86 + 1.87 +MemoryUsage G1OldGenPool::get_memory_usage() { 1.88 + size_t initial_sz = initial_size(); 1.89 + size_t max_sz = max_size(); 1.90 + size_t used = used_in_bytes(); 1.91 + size_t committed = _g1mm->old_space_committed(); 1.92 + 1.93 + return MemoryUsage(initial_sz, used, committed, max_sz); 1.94 +}