src/share/vm/services/memoryService.hpp

Fri, 30 Jul 2010 22:43:50 +0100

author
kevinw
date
Fri, 30 Jul 2010 22:43:50 +0100
changeset 2058
f6f3eef8a521
parent 1907
c18cbe5936b8
child 2314
f95d63e2154a
permissions
-rw-r--r--

6581734: CMS Old Gen's collection usage is zero after GC which is incorrect
Summary: Management code enabled for use by a concurrent collector.
Reviewed-by: mchung, ysr

duke@435 1 /*
trims@1907 2 * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 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.
duke@435 22 *
duke@435 23 */
duke@435 24
duke@435 25 // Forward declaration
duke@435 26 class MemoryPool;
duke@435 27 class MemoryManager;
duke@435 28 class GCMemoryManager;
duke@435 29 class CollectedHeap;
duke@435 30 class Generation;
duke@435 31 class DefNewGeneration;
duke@435 32 class PSYoungGen;
duke@435 33 class PSOldGen;
duke@435 34 class PSPermGen;
duke@435 35 class CodeHeap;
duke@435 36 class ContiguousSpace;
duke@435 37 class CompactibleFreeListSpace;
duke@435 38 class PermanentGenerationSpec;
duke@435 39 class GenCollectedHeap;
duke@435 40 class ParallelScavengeHeap;
duke@435 41 class CompactingPermGenGen;
duke@435 42 class CMSPermGenGen;
tonyp@1524 43 class G1CollectedHeap;
duke@435 44
duke@435 45 // VM Monitoring and Management Support
duke@435 46
duke@435 47 class MemoryService : public AllStatic {
duke@435 48 private:
duke@435 49 enum {
duke@435 50 init_pools_list_size = 10,
duke@435 51 init_managers_list_size = 5
duke@435 52 };
duke@435 53
duke@435 54 // index for minor and major generations
duke@435 55 enum {
duke@435 56 minor = 0,
duke@435 57 major = 1,
duke@435 58 n_gens = 2
duke@435 59 };
duke@435 60
duke@435 61 static GrowableArray<MemoryPool*>* _pools_list;
duke@435 62 static GrowableArray<MemoryManager*>* _managers_list;
duke@435 63
duke@435 64 // memory managers for minor and major GC statistics
duke@435 65 static GCMemoryManager* _major_gc_manager;
duke@435 66 static GCMemoryManager* _minor_gc_manager;
duke@435 67
duke@435 68 // Code heap memory pool
duke@435 69 static MemoryPool* _code_heap_pool;
duke@435 70
duke@435 71 static void add_generation_memory_pool(Generation* gen,
duke@435 72 MemoryManager* major_mgr,
duke@435 73 MemoryManager* minor_mgr);
duke@435 74 static void add_generation_memory_pool(Generation* gen,
duke@435 75 MemoryManager* major_mgr) {
duke@435 76 add_generation_memory_pool(gen, major_mgr, NULL);
duke@435 77 }
duke@435 78
duke@435 79 static void add_compact_perm_gen_memory_pool(CompactingPermGenGen* perm_gen,
duke@435 80 MemoryManager* mgr);
duke@435 81 static void add_cms_perm_gen_memory_pool(CMSPermGenGen* perm_gen,
duke@435 82 MemoryManager* mgr);
duke@435 83
duke@435 84 static void add_psYoung_memory_pool(PSYoungGen* gen,
duke@435 85 MemoryManager* major_mgr,
duke@435 86 MemoryManager* minor_mgr);
duke@435 87 static void add_psOld_memory_pool(PSOldGen* gen,
duke@435 88 MemoryManager* mgr);
duke@435 89 static void add_psPerm_memory_pool(PSPermGen* perm,
duke@435 90 MemoryManager* mgr);
duke@435 91
tonyp@1524 92 static void add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
tonyp@1524 93 MemoryManager* major_mgr,
tonyp@1524 94 MemoryManager* minor_mgr);
tonyp@1524 95 static void add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
tonyp@1524 96 MemoryManager* mgr);
tonyp@1524 97 static void add_g1PermGen_memory_pool(G1CollectedHeap* g1h,
tonyp@1524 98 MemoryManager* mgr);
duke@435 99
duke@435 100 static MemoryPool* add_space(ContiguousSpace* space,
duke@435 101 const char* name,
duke@435 102 bool is_heap,
duke@435 103 size_t max_size,
duke@435 104 bool support_usage_threshold);
duke@435 105 static MemoryPool* add_survivor_spaces(DefNewGeneration* gen,
duke@435 106 const char* name,
duke@435 107 bool is_heap,
duke@435 108 size_t max_size,
duke@435 109 bool support_usage_threshold);
duke@435 110 static MemoryPool* add_gen(Generation* gen,
duke@435 111 const char* name,
duke@435 112 bool is_heap,
duke@435 113 bool support_usage_threshold);
duke@435 114 static MemoryPool* add_cms_space(CompactibleFreeListSpace* space,
duke@435 115 const char* name,
duke@435 116 bool is_heap,
duke@435 117 size_t max_size,
duke@435 118 bool support_usage_threshold);
duke@435 119
duke@435 120 static void add_gen_collected_heap_info(GenCollectedHeap* heap);
duke@435 121 static void add_parallel_scavenge_heap_info(ParallelScavengeHeap* heap);
tonyp@1524 122 static void add_g1_heap_info(G1CollectedHeap* g1h);
duke@435 123
duke@435 124 public:
duke@435 125 static void set_universe_heap(CollectedHeap* heap);
duke@435 126 static void add_code_heap_memory_pool(CodeHeap* heap);
duke@435 127
duke@435 128 static MemoryPool* get_memory_pool(instanceHandle pool);
duke@435 129 static MemoryManager* get_memory_manager(instanceHandle mgr);
duke@435 130
duke@435 131 static const int num_memory_pools() {
duke@435 132 return _pools_list->length();
duke@435 133 }
duke@435 134 static const int num_memory_managers() {
duke@435 135 return _managers_list->length();
duke@435 136 }
duke@435 137
duke@435 138 static MemoryPool* get_memory_pool(int index) {
duke@435 139 return _pools_list->at(index);
duke@435 140 }
duke@435 141
duke@435 142 static MemoryManager* get_memory_manager(int index) {
duke@435 143 return _managers_list->at(index);
duke@435 144 }
duke@435 145
duke@435 146 static void track_memory_usage();
duke@435 147 static void track_code_cache_memory_usage() {
duke@435 148 track_memory_pool_usage(_code_heap_pool);
duke@435 149 }
duke@435 150 static void track_memory_pool_usage(MemoryPool* pool);
duke@435 151
kevinw@2058 152 static void gc_begin(bool fullGC, bool recordGCBeginTime,
kevinw@2058 153 bool recordAccumulatedGCTime,
kevinw@2058 154 bool recordPreGCUsage, bool recordPeakUsage);
kevinw@2058 155 static void gc_end(bool fullGC, bool recordPostGCUsage,
kevinw@2058 156 bool recordAccumulatedGCTime,
kevinw@2058 157 bool recordGCEndTime, bool countCollection);
kevinw@2058 158
duke@435 159
duke@435 160 static void oops_do(OopClosure* f);
duke@435 161
duke@435 162 static bool get_verbose() { return PrintGC; }
duke@435 163 static bool set_verbose(bool verbose);
duke@435 164
duke@435 165 // Create an instance of java/lang/management/MemoryUsage
duke@435 166 static Handle create_MemoryUsage_obj(MemoryUsage usage, TRAPS);
duke@435 167 };
duke@435 168
duke@435 169 class TraceMemoryManagerStats : public StackObj {
duke@435 170 private:
duke@435 171 bool _fullGC;
kevinw@2058 172 bool _recordGCBeginTime;
kevinw@2058 173 bool _recordPreGCUsage;
kevinw@2058 174 bool _recordPeakUsage;
kevinw@2058 175 bool _recordPostGCUsage;
kevinw@2058 176 bool _recordAccumulatedGCTime;
kevinw@2058 177 bool _recordGCEndTime;
kevinw@2058 178 bool _countCollection;
kevinw@2058 179
duke@435 180 public:
kevinw@2058 181 TraceMemoryManagerStats() {}
kevinw@2058 182 TraceMemoryManagerStats(bool fullGC,
kevinw@2058 183 bool recordGCBeginTime = true,
kevinw@2058 184 bool recordPreGCUsage = true,
kevinw@2058 185 bool recordPeakUsage = true,
kevinw@2058 186 bool recordPostGCUsage = true,
kevinw@2058 187 bool recordAccumulatedGCTime = true,
kevinw@2058 188 bool recordGCEndTime = true,
kevinw@2058 189 bool countCollection = true);
kevinw@2058 190
kevinw@2058 191 void initialize(bool fullGC,
kevinw@2058 192 bool recordGCBeginTime,
kevinw@2058 193 bool recordPreGCUsage,
kevinw@2058 194 bool recordPeakUsage,
kevinw@2058 195 bool recordPostGCUsage,
kevinw@2058 196 bool recordAccumulatedGCTime,
kevinw@2058 197 bool recordGCEndTime,
kevinw@2058 198 bool countCollection);
kevinw@2058 199
duke@435 200 TraceMemoryManagerStats(Generation::Name kind);
duke@435 201 ~TraceMemoryManagerStats();
duke@435 202 };

mercurial