Mercurial > hg > truffle
comparison src/share/vm/services/memoryService.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 | 1d1603768966 |
children | d2a62e0f25eb |
comparison
equal
deleted
inserted
replaced
3355:f1cbbee6713b | 3356:78542e2b5e35 |
---|---|
563 } | 563 } |
564 } | 564 } |
565 | 565 |
566 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, | 566 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage, |
567 bool recordAccumulatedGCTime, | 567 bool recordAccumulatedGCTime, |
568 bool recordGCEndTime, bool countCollection) { | 568 bool recordGCEndTime, bool countCollection, |
569 GCCause::Cause cause) { | |
569 | 570 |
570 GCMemoryManager* mgr; | 571 GCMemoryManager* mgr; |
571 if (fullGC) { | 572 if (fullGC) { |
572 mgr = (GCMemoryManager*) _major_gc_manager; | 573 mgr = (GCMemoryManager*) _major_gc_manager; |
573 } else { | 574 } else { |
575 } | 576 } |
576 assert(mgr->is_gc_memory_manager(), "Sanity check"); | 577 assert(mgr->is_gc_memory_manager(), "Sanity check"); |
577 | 578 |
578 // register the GC end statistics and memory usage | 579 // register the GC end statistics and memory usage |
579 mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, | 580 mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
580 countCollection); | 581 countCollection, cause); |
581 } | 582 } |
582 | 583 |
583 void MemoryService::oops_do(OopClosure* f) { | 584 void MemoryService::oops_do(OopClosure* f) { |
584 int i; | 585 int i; |
585 | 586 |
631 // manager or both. The type of gc manager depends on the generation kind. | 632 // manager or both. The type of gc manager depends on the generation kind. |
632 // For DefNew, ParNew and ASParNew generation doing scavenge gc uses minor | 633 // For DefNew, ParNew and ASParNew generation doing scavenge gc uses minor |
633 // gc manager (so _fullGC is set to false ) and for other generation kinds | 634 // gc manager (so _fullGC is set to false ) and for other generation kinds |
634 // doing mark-sweep-compact uses major gc manager (so _fullGC is set | 635 // doing mark-sweep-compact uses major gc manager (so _fullGC is set |
635 // to true). | 636 // to true). |
636 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind) { | 637 TraceMemoryManagerStats::TraceMemoryManagerStats(Generation::Name kind, GCCause::Cause cause) { |
637 switch (kind) { | 638 switch (kind) { |
638 case Generation::DefNew: | 639 case Generation::DefNew: |
639 #ifndef SERIALGC | 640 #ifndef SERIALGC |
640 case Generation::ParNew: | 641 case Generation::ParNew: |
641 case Generation::ASParNew: | 642 case Generation::ASParNew: |
652 default: | 653 default: |
653 assert(false, "Unrecognized gc generation kind."); | 654 assert(false, "Unrecognized gc generation kind."); |
654 } | 655 } |
655 // this has to be called in a stop the world pause and represent | 656 // this has to be called in a stop the world pause and represent |
656 // an entire gc pause, start to finish: | 657 // an entire gc pause, start to finish: |
657 initialize(_fullGC, true, true, true, true, true, true, true); | 658 initialize(_fullGC, cause,true, true, true, true, true, true, true); |
658 } | 659 } |
659 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, | 660 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC, |
661 GCCause::Cause cause, | |
660 bool recordGCBeginTime, | 662 bool recordGCBeginTime, |
661 bool recordPreGCUsage, | 663 bool recordPreGCUsage, |
662 bool recordPeakUsage, | 664 bool recordPeakUsage, |
663 bool recordPostGCUsage, | 665 bool recordPostGCUsage, |
664 bool recordAccumulatedGCTime, | 666 bool recordAccumulatedGCTime, |
665 bool recordGCEndTime, | 667 bool recordGCEndTime, |
666 bool countCollection) { | 668 bool countCollection) { |
667 initialize(fullGC, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, | 669 initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage, |
668 recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, | 670 recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime, |
669 countCollection); | 671 countCollection); |
670 } | 672 } |
671 | 673 |
672 // for a subclass to create then initialize an instance before invoking | 674 // for a subclass to create then initialize an instance before invoking |
673 // the MemoryService | 675 // the MemoryService |
674 void TraceMemoryManagerStats::initialize(bool fullGC, | 676 void TraceMemoryManagerStats::initialize(bool fullGC, |
677 GCCause::Cause cause, | |
675 bool recordGCBeginTime, | 678 bool recordGCBeginTime, |
676 bool recordPreGCUsage, | 679 bool recordPreGCUsage, |
677 bool recordPeakUsage, | 680 bool recordPeakUsage, |
678 bool recordPostGCUsage, | 681 bool recordPostGCUsage, |
679 bool recordAccumulatedGCTime, | 682 bool recordAccumulatedGCTime, |
685 _recordPeakUsage = recordPeakUsage; | 688 _recordPeakUsage = recordPeakUsage; |
686 _recordPostGCUsage = recordPostGCUsage; | 689 _recordPostGCUsage = recordPostGCUsage; |
687 _recordAccumulatedGCTime = recordAccumulatedGCTime; | 690 _recordAccumulatedGCTime = recordAccumulatedGCTime; |
688 _recordGCEndTime = recordGCEndTime; | 691 _recordGCEndTime = recordGCEndTime; |
689 _countCollection = countCollection; | 692 _countCollection = countCollection; |
693 _cause = cause; | |
690 | 694 |
691 MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime, | 695 MemoryService::gc_begin(_fullGC, _recordGCBeginTime, _recordAccumulatedGCTime, |
692 _recordPreGCUsage, _recordPeakUsage); | 696 _recordPreGCUsage, _recordPeakUsage); |
693 } | 697 } |
694 | 698 |
695 TraceMemoryManagerStats::~TraceMemoryManagerStats() { | 699 TraceMemoryManagerStats::~TraceMemoryManagerStats() { |
696 MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, | 700 MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime, |
697 _recordGCEndTime, _countCollection); | 701 _recordGCEndTime, _countCollection, _cause); |
698 } | 702 } |
699 | 703 |