< prev index next >

src/hotspot/share/gc/g1/g1MonitoringSupport.hpp

Print this page
rev 51302 : imported patch 8209061-move-serviceability-to-monitoringsupport
rev 51303 : imported patch 8209062-cleanup-monitoringsupport
rev 51304 : [mq]: 8207200-getmemoryusage-consistency

@@ -27,10 +27,11 @@
 
 #include "gc/shared/collectorCounters.hpp"
 #include "gc/shared/generationCounters.hpp"
 #include "services/memoryManager.hpp"
 #include "services/memoryService.hpp"
+#include "runtime/mutex.hpp"
 
 class CollectorCounters;
 class G1CollectedHeap;
 class HSpaceCounters;
 class MemoryPool;

@@ -122,10 +123,12 @@
   friend class VMStructs;
   friend class G1MonitoringScope;
 
   G1CollectedHeap* _g1h;
 
+  Mutex _update_mutex;
+
   // java.lang.management MemoryManager and MemoryPool support  
   GCMemoryManager _incremental_memory_manager;
   GCMemoryManager _full_gc_memory_manager;
 
   MemoryPool* _eden_pool;

@@ -196,10 +199,12 @@
 public:
   G1MonitoringSupport(G1CollectedHeap* g1h);
   ~G1MonitoringSupport();
 
   void initialize_serviceability();
+
+  MemoryUsage memory_usage();
   GrowableArray<GCMemoryManager*> memory_managers();
   GrowableArray<MemoryPool*> memory_pools();
 
   // Unfortunately, the jstat tool assumes that no space has 0
   // capacity. In our case, given that each space is logical, it's

@@ -228,20 +233,26 @@
 
   // Monitoring support used by
   //   MemoryService
   //   jstat counters
   //   Tracing
+  // Values may not be consistent wrt to each other.
 
   size_t young_gen_committed()        { return _young_gen_committed; }
 
-  size_t eden_space_committed()       { return _eden_space_committed; }
   size_t eden_space_used()            { return _eden_space_used; }
-  size_t survivor_space_committed()   { return _survivor_space_committed; }
   size_t survivor_space_used()        { return _survivor_space_used; }
 
   size_t old_gen_committed()          { return _old_gen_committed; }
   size_t old_gen_used()               { return _old_gen_used; }
+
+  // Monitoring support for MemoryPools. Values in the returned MemoryUsage are
+  // guaranteed to be consistent with each other.
+  MemoryUsage eden_space_memory_usage(size_t initial_size, size_t max_size);
+  MemoryUsage survivor_space_memory_usage(size_t initial_size, size_t max_size);
+
+  MemoryUsage old_gen_memory_usage(size_t initial_size, size_t max_size);
 };
 
 // Scope object for java.lang.management support.
 class G1MonitoringScope : public StackObj {
   TraceCollectorStats _tcs;
< prev index next >