diff options
author | fparain <none@none> | 2011-05-12 10:30:11 -0700 |
---|---|---|
committer | fparain <none@none> | 2011-05-12 10:30:11 -0700 |
commit | f31a92a1336fbd929e82bf150ef381eca44cb584 (patch) | |
tree | 77c8a1519d6e56b8727c48039bbc463f51795dee /src/share/vm/services/memoryManager.cpp | |
parent | 0466ad091bb01c844a5d7d16be3a34c2f6319457 (diff) |
7036199: Adding a notification to the implementation of GarbageCollectorMXBeans
Summary: Add a notification to the GarbageCollectorMXBeans
Reviewed-by: acorn, mchung
Diffstat (limited to 'src/share/vm/services/memoryManager.cpp')
-rw-r--r-- | src/share/vm/services/memoryManager.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/share/vm/services/memoryManager.cpp b/src/share/vm/services/memoryManager.cpp index e13b64376..3977a4562 100644 --- a/src/share/vm/services/memoryManager.cpp +++ b/src/share/vm/services/memoryManager.cpp @@ -33,6 +33,7 @@ #include "services/memoryManager.hpp" #include "services/memoryPool.hpp" #include "services/memoryService.hpp" +#include "services/gcNotifier.hpp" #include "utilities/dtrace.hpp" HS_DTRACE_PROBE_DECL8(hotspot, mem__pool__gc__begin, char*, int, char*, int, @@ -202,6 +203,7 @@ GCMemoryManager::GCMemoryManager() : MemoryManager() { _last_gc_lock = new Mutex(Mutex::leaf, "_last_gc_lock", true); _current_gc_stat = NULL; _num_gc_threads = 1; + _notification_enabled = false; } GCMemoryManager::~GCMemoryManager() { @@ -250,7 +252,8 @@ void GCMemoryManager::gc_begin(bool recordGCBeginTime, bool recordPreGCUsage, // to ensure the current gc stat is placed in _last_gc_stat. void GCMemoryManager::gc_end(bool recordPostGCUsage, bool recordAccumulatedGCTime, - bool recordGCEndTime, bool countCollection) { + bool recordGCEndTime, bool countCollection, + GCCause::Cause cause) { if (recordAccumulatedGCTime) { _accumulated_timer.stop(); } @@ -283,6 +286,11 @@ void GCMemoryManager::gc_end(bool recordPostGCUsage, pool->set_last_collection_usage(usage); LowMemoryDetector::detect_after_gc_memory(pool); } + if(is_notification_enabled()) { + bool isMajorGC = this == MemoryService::get_major_gc_manager(); + GCNotifier::pushNotification(this, isMajorGC ? "end of major GC" : "end of minor GC", + GCCause::to_string(cause)); + } } if (countCollection) { _num_collections++; |