Mercurial > hg > graal-jvmci-8
comparison src/share/vm/services/memoryManager.hpp @ 1703:f6f3eef8a521
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
author | kevinw |
---|---|
date | Fri, 30 Jul 2010 22:43:50 +0100 |
parents | c18cbe5936b8 |
children | f95d63e2154a |
comparison
equal
deleted
inserted
replaced
1594:b9bc732be7c0 | 1703:f6f3eef8a521 |
---|---|
129 MemoryUsage after_gc_usage_for_pool(int pool_index) { | 129 MemoryUsage after_gc_usage_for_pool(int pool_index) { |
130 assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking"); | 130 assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking"); |
131 return _after_gc_usage_array[pool_index]; | 131 return _after_gc_usage_array[pool_index]; |
132 } | 132 } |
133 | 133 |
134 MemoryUsage* before_gc_usage_array() { return _before_gc_usage_array; } | |
135 MemoryUsage* after_gc_usage_array() { return _after_gc_usage_array; } | |
136 | |
134 void set_index(size_t index) { _index = index; } | 137 void set_index(size_t index) { _index = index; } |
135 void set_start_time(jlong time) { _start_time = time; } | 138 void set_start_time(jlong time) { _start_time = time; } |
136 void set_end_time(jlong time) { _end_time = time; } | 139 void set_end_time(jlong time) { _end_time = time; } |
137 void set_before_gc_usage(int pool_index, MemoryUsage usage) { | 140 void set_before_gc_usage(int pool_index, MemoryUsage usage) { |
138 assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking"); | 141 assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking"); |
141 void set_after_gc_usage(int pool_index, MemoryUsage usage) { | 144 void set_after_gc_usage(int pool_index, MemoryUsage usage) { |
142 assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking"); | 145 assert(pool_index >= 0 && pool_index < _usage_array_size, "Range checking"); |
143 set_gc_usage(pool_index, usage, false /* after gc */); | 146 set_gc_usage(pool_index, usage, false /* after gc */); |
144 } | 147 } |
145 | 148 |
146 void copy_stat(GCStatInfo* stat); | 149 void clear(); |
147 }; | 150 }; |
148 | 151 |
149 class GCMemoryManager : public MemoryManager { | 152 class GCMemoryManager : public MemoryManager { |
150 private: | 153 private: |
151 // TODO: We should unify the GCCounter and GCMemoryManager statistic | 154 // TODO: We should unify the GCCounter and GCMemoryManager statistic |
152 size_t _num_collections; | 155 size_t _num_collections; |
153 elapsedTimer _accumulated_timer; | 156 elapsedTimer _accumulated_timer; |
154 elapsedTimer _gc_timer; // for measuring every GC duration | 157 elapsedTimer _gc_timer; // for measuring every GC duration |
155 GCStatInfo* _last_gc_stat; | 158 GCStatInfo* _last_gc_stat; |
159 Mutex* _last_gc_lock; | |
160 GCStatInfo* _current_gc_stat; | |
156 int _num_gc_threads; | 161 int _num_gc_threads; |
157 public: | 162 public: |
158 GCMemoryManager(); | 163 GCMemoryManager(); |
159 ~GCMemoryManager(); | 164 ~GCMemoryManager(); |
160 | 165 |
164 jlong gc_time_ms() { return _accumulated_timer.milliseconds(); } | 169 jlong gc_time_ms() { return _accumulated_timer.milliseconds(); } |
165 size_t gc_count() { return _num_collections; } | 170 size_t gc_count() { return _num_collections; } |
166 int num_gc_threads() { return _num_gc_threads; } | 171 int num_gc_threads() { return _num_gc_threads; } |
167 void set_num_gc_threads(int count) { _num_gc_threads = count; } | 172 void set_num_gc_threads(int count) { _num_gc_threads = count; } |
168 | 173 |
169 void gc_begin(); | 174 void gc_begin(bool recordGCBeginTime, bool recordPreGCUsage, |
170 void gc_end(); | 175 bool recordAccumulatedGCTime); |
176 void gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime, | |
177 bool recordGCEndTime, bool countCollection); | |
171 | 178 |
172 void reset_gc_stat() { _num_collections = 0; _accumulated_timer.reset(); } | 179 void reset_gc_stat() { _num_collections = 0; _accumulated_timer.reset(); } |
173 GCStatInfo* last_gc_stat() { return _last_gc_stat; } | 180 |
181 // Copy out _last_gc_stat to the given destination, returning | |
182 // the collection count. Zero signifies no gc has taken place. | |
183 size_t get_last_gc_stat(GCStatInfo* dest); | |
174 | 184 |
175 virtual MemoryManager::Name kind() = 0; | 185 virtual MemoryManager::Name kind() = 0; |
176 }; | 186 }; |
177 | 187 |
178 // These subclasses of GCMemoryManager are defined to include | 188 // These subclasses of GCMemoryManager are defined to include |