comparison src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp @ 3356:78542e2b5e35

7036199: Adding a notification to the implementation of GarbageCollectorMXBeans Summary: Add a notification to the GarbageCollectorMXBeans Reviewed-by: acorn, mchung
author fparain
date Thu, 12 May 2011 10:30:11 -0700
parents 1f4413413144
children 8cbcd406c42e
comparison
equal deleted inserted replaced
3355:f1cbbee6713b 3356:78542e2b5e35
2024 _inter_sweep_estimate.padded_average(), 2024 _inter_sweep_estimate.padded_average(),
2025 _intra_sweep_estimate.padded_average()); 2025 _intra_sweep_estimate.padded_average());
2026 } 2026 }
2027 2027
2028 { 2028 {
2029 TraceCMSMemoryManagerStats(); 2029 TraceCMSMemoryManagerStats tmms(gch->gc_cause());
2030 } 2030 }
2031 GenMarkSweep::invoke_at_safepoint(_cmsGen->level(), 2031 GenMarkSweep::invoke_at_safepoint(_cmsGen->level(),
2032 ref_processor(), clear_all_soft_refs); 2032 ref_processor(), clear_all_soft_refs);
2033 #ifdef ASSERT 2033 #ifdef ASSERT
2034 CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace(); 2034 CompactibleFreeListSpace* cms_space = _cmsGen->cmsSpace();
3477 // this generation. [Note this initial checkpoint need only 3477 // this generation. [Note this initial checkpoint need only
3478 // be approximate -- we'll do a catch up phase subsequently.] 3478 // be approximate -- we'll do a catch up phase subsequently.]
3479 void CMSCollector::checkpointRootsInitial(bool asynch) { 3479 void CMSCollector::checkpointRootsInitial(bool asynch) {
3480 assert(_collectorState == InitialMarking, "Wrong collector state"); 3480 assert(_collectorState == InitialMarking, "Wrong collector state");
3481 check_correct_thread_executing(); 3481 check_correct_thread_executing();
3482 TraceCMSMemoryManagerStats tms(_collectorState); 3482 TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
3483 3483
3484 ReferenceProcessor* rp = ref_processor(); 3484 ReferenceProcessor* rp = ref_processor();
3485 SpecializationStats::clear(); 3485 SpecializationStats::clear();
3486 assert(_restart_addr == NULL, "Control point invariant"); 3486 assert(_restart_addr == NULL, "Control point invariant");
3487 if (asynch) { 3487 if (asynch) {
4856 assert(_collectorState == FinalMarking, "incorrect state transition?"); 4856 assert(_collectorState == FinalMarking, "incorrect state transition?");
4857 check_correct_thread_executing(); 4857 check_correct_thread_executing();
4858 // world is stopped at this checkpoint 4858 // world is stopped at this checkpoint
4859 assert(SafepointSynchronize::is_at_safepoint(), 4859 assert(SafepointSynchronize::is_at_safepoint(),
4860 "world should be stopped"); 4860 "world should be stopped");
4861 TraceCMSMemoryManagerStats tms(_collectorState); 4861 TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
4862
4862 verify_work_stacks_empty(); 4863 verify_work_stacks_empty();
4863 verify_overflow_empty(); 4864 verify_overflow_empty();
4864 4865
4865 SpecializationStats::clear(); 4866 SpecializationStats::clear();
4866 if (PrintGCDetails) { 4867 if (PrintGCDetails) {
5991 assert(_collectorState == Sweeping, "just checking"); 5992 assert(_collectorState == Sweeping, "just checking");
5992 check_correct_thread_executing(); 5993 check_correct_thread_executing();
5993 verify_work_stacks_empty(); 5994 verify_work_stacks_empty();
5994 verify_overflow_empty(); 5995 verify_overflow_empty();
5995 increment_sweep_count(); 5996 increment_sweep_count();
5996 TraceCMSMemoryManagerStats tms(_collectorState); 5997 TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
5997 5998
5998 _inter_sweep_timer.stop(); 5999 _inter_sweep_timer.stop();
5999 _inter_sweep_estimate.sample(_inter_sweep_timer.seconds()); 6000 _inter_sweep_estimate.sample(_inter_sweep_timer.seconds());
6000 size_policy()->avg_cms_free_at_sweep()->sample(_cmsGen->free()); 6001 size_policy()->avg_cms_free_at_sweep()->sample(_cmsGen->free());
6001 6002
9233 } 9234 }
9234 // Could be 0, if the block size could not be computed without stalling. 9235 // Could be 0, if the block size could not be computed without stalling.
9235 return res; 9236 return res;
9236 } 9237 }
9237 9238
9238 TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorState phase): TraceMemoryManagerStats() { 9239 TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(CMSCollector::CollectorState phase, GCCause::Cause cause): TraceMemoryManagerStats() {
9239 9240
9240 switch (phase) { 9241 switch (phase) {
9241 case CMSCollector::InitialMarking: 9242 case CMSCollector::InitialMarking:
9242 initialize(true /* fullGC */ , 9243 initialize(true /* fullGC */ ,
9244 cause /* cause of the GC */,
9243 true /* recordGCBeginTime */, 9245 true /* recordGCBeginTime */,
9244 true /* recordPreGCUsage */, 9246 true /* recordPreGCUsage */,
9245 false /* recordPeakUsage */, 9247 false /* recordPeakUsage */,
9246 false /* recordPostGCusage */, 9248 false /* recordPostGCusage */,
9247 true /* recordAccumulatedGCTime */, 9249 true /* recordAccumulatedGCTime */,
9249 false /* countCollection */ ); 9251 false /* countCollection */ );
9250 break; 9252 break;
9251 9253
9252 case CMSCollector::FinalMarking: 9254 case CMSCollector::FinalMarking:
9253 initialize(true /* fullGC */ , 9255 initialize(true /* fullGC */ ,
9256 cause /* cause of the GC */,
9254 false /* recordGCBeginTime */, 9257 false /* recordGCBeginTime */,
9255 false /* recordPreGCUsage */, 9258 false /* recordPreGCUsage */,
9256 false /* recordPeakUsage */, 9259 false /* recordPeakUsage */,
9257 false /* recordPostGCusage */, 9260 false /* recordPostGCusage */,
9258 true /* recordAccumulatedGCTime */, 9261 true /* recordAccumulatedGCTime */,
9260 false /* countCollection */ ); 9263 false /* countCollection */ );
9261 break; 9264 break;
9262 9265
9263 case CMSCollector::Sweeping: 9266 case CMSCollector::Sweeping:
9264 initialize(true /* fullGC */ , 9267 initialize(true /* fullGC */ ,
9268 cause /* cause of the GC */,
9265 false /* recordGCBeginTime */, 9269 false /* recordGCBeginTime */,
9266 false /* recordPreGCUsage */, 9270 false /* recordPreGCUsage */,
9267 true /* recordPeakUsage */, 9271 true /* recordPeakUsage */,
9268 true /* recordPostGCusage */, 9272 true /* recordPostGCusage */,
9269 false /* recordAccumulatedGCTime */, 9273 false /* recordAccumulatedGCTime */,
9275 ShouldNotReachHere(); 9279 ShouldNotReachHere();
9276 } 9280 }
9277 } 9281 }
9278 9282
9279 // when bailing out of cms in concurrent mode failure 9283 // when bailing out of cms in concurrent mode failure
9280 TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(): TraceMemoryManagerStats() { 9284 TraceCMSMemoryManagerStats::TraceCMSMemoryManagerStats(GCCause::Cause cause): TraceMemoryManagerStats() {
9281 initialize(true /* fullGC */ , 9285 initialize(true /* fullGC */ ,
9286 cause /* cause of the GC */,
9282 true /* recordGCBeginTime */, 9287 true /* recordGCBeginTime */,
9283 true /* recordPreGCUsage */, 9288 true /* recordPreGCUsage */,
9284 true /* recordPeakUsage */, 9289 true /* recordPeakUsage */,
9285 true /* recordPostGCusage */, 9290 true /* recordPostGCusage */,
9286 true /* recordAccumulatedGCTime */, 9291 true /* recordAccumulatedGCTime */,