< prev index next >

src/share/vm/services/memoryService.cpp

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -185,11 +185,11 @@
   _major_gc_manager = MemoryManager::get_g1OldGen_memory_manager();
   _managers_list->append(_minor_gc_manager);
   _managers_list->append(_major_gc_manager);
 
   add_g1YoungGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
-  add_g1OldGen_memory_pool(g1h, _major_gc_manager);
+  add_g1OldGen_memory_pool(g1h, _major_gc_manager, _minor_gc_manager);
 }
 #endif // INCLUDE_ALL_GCS
 
 MemoryPool* MemoryService::add_gen(Generation* gen,
                                    const char* name,

@@ -239,12 +239,12 @@
 }
 #endif // INCLUDE_ALL_GCS
 
 // Add memory pool(s) for one generation
 void MemoryService::add_generation_memory_pool(Generation* gen,
-                                               MemoryManager* major_mgr,
-                                               MemoryManager* minor_mgr) {
+                                               GCMemoryManager* major_mgr,
+                                               GCMemoryManager* minor_mgr) {
   guarantee(gen != NULL, "No generation for memory pool");
   Generation::Name kind = gen->kind();
   int index = _pools_list->length();
 
   switch (kind) {

@@ -330,11 +330,13 @@
   }
 }
 
 
 #if INCLUDE_ALL_GCS
-void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen, MemoryManager* major_mgr, MemoryManager* minor_mgr) {
+void MemoryService::add_psYoung_memory_pool(PSYoungGen* gen,
+                                            GCMemoryManager* major_mgr,
+                                            GCMemoryManager* minor_mgr) {
   assert(major_mgr != NULL && minor_mgr != NULL, "Should have two managers");
 
   // Add a memory pool for each space and young gen doesn't
   // support low memory detection as it is expected to get filled up.
   EdenMutableSpacePool* eden = new EdenMutableSpacePool(gen,

@@ -354,22 +356,22 @@
   minor_mgr->add_pool(survivor);
   _pools_list->append(eden);
   _pools_list->append(survivor);
 }
 
-void MemoryService::add_psOld_memory_pool(PSOldGen* gen, MemoryManager* mgr) {
+void MemoryService::add_psOld_memory_pool(PSOldGen* gen, GCMemoryManager* mgr) {
   PSGenerationPool* old_gen = new PSGenerationPool(gen,
                                                    "PS Old Gen",
                                                    MemoryPool::Heap,
                                                    true /* support_usage_threshold */);
   mgr->add_pool(old_gen);
   _pools_list->append(old_gen);
 }
 
 void MemoryService::add_g1YoungGen_memory_pool(G1CollectedHeap* g1h,
-                                               MemoryManager* major_mgr,
-                                               MemoryManager* minor_mgr) {
+                                               GCMemoryManager* major_mgr,
+                                               GCMemoryManager* minor_mgr) {
   assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers");
 
   G1EdenPool* eden = new G1EdenPool(g1h);
   G1SurvivorPool* survivor = new G1SurvivorPool(g1h);
 

@@ -380,15 +382,17 @@
   _pools_list->append(eden);
   _pools_list->append(survivor);
 }
 
 void MemoryService::add_g1OldGen_memory_pool(G1CollectedHeap* g1h,
-                                             MemoryManager* mgr) {
-  assert(mgr != NULL, "should have one manager");
+                                             GCMemoryManager* major_mgr,
+                                             GCMemoryManager* minor_mgr) {
+  assert(major_mgr != NULL && minor_mgr != NULL, "should have two managers");
 
   G1OldGenPool* old_gen = new G1OldGenPool(g1h);
-  mgr->add_pool(old_gen);
+  major_mgr->add_pool(old_gen);
+  minor_mgr->add_pool(old_gen, false /* always_affected_by_gc */);
   _pools_list->append(old_gen);
 }
 #endif // INCLUDE_ALL_GCS
 
 void MemoryService::add_code_heap_memory_pool(CodeHeap* heap) {

@@ -482,11 +486,12 @@
 }
 
 void MemoryService::gc_end(bool fullGC, bool recordPostGCUsage,
                            bool recordAccumulatedGCTime,
                            bool recordGCEndTime, bool countCollection,
-                           GCCause::Cause cause) {
+                           GCCause::Cause cause,
+                           bool allMemoryPoolsAffected) {
 
   GCMemoryManager* mgr;
   if (fullGC) {
     mgr = (GCMemoryManager*) _major_gc_manager;
   } else {

@@ -494,11 +499,11 @@
   }
   assert(mgr->is_gc_memory_manager(), "Sanity check");
 
   // register the GC end statistics and memory usage
   mgr->gc_end(recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
-              countCollection, cause);
+              countCollection, cause, allMemoryPoolsAffected);
 }
 
 void MemoryService::oops_do(OopClosure* f) {
   int i;
 

@@ -571,38 +576,42 @@
     default:
       assert(false, "Unrecognized gc generation kind.");
   }
   // this has to be called in a stop the world pause and represent
   // an entire gc pause, start to finish:
-  initialize(_fullGC, cause,true, true, true, true, true, true, true);
+  initialize(_fullGC, cause, true, true, true, true, true, true, true, true);
 }
 TraceMemoryManagerStats::TraceMemoryManagerStats(bool fullGC,
                                                  GCCause::Cause cause,
+                                                 bool allMemoryPoolsAffected,
                                                  bool recordGCBeginTime,
                                                  bool recordPreGCUsage,
                                                  bool recordPeakUsage,
                                                  bool recordPostGCUsage,
                                                  bool recordAccumulatedGCTime,
                                                  bool recordGCEndTime,
                                                  bool countCollection) {
-    initialize(fullGC, cause, recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
+  initialize(fullGC, cause, allMemoryPoolsAffected,
+             recordGCBeginTime, recordPreGCUsage, recordPeakUsage,
              recordPostGCUsage, recordAccumulatedGCTime, recordGCEndTime,
              countCollection);
 }
 
 // for a subclass to create then initialize an instance before invoking
 // the MemoryService
 void TraceMemoryManagerStats::initialize(bool fullGC,
                                          GCCause::Cause cause,
+                                         bool allMemoryPoolsAffected,
                                          bool recordGCBeginTime,
                                          bool recordPreGCUsage,
                                          bool recordPeakUsage,
                                          bool recordPostGCUsage,
                                          bool recordAccumulatedGCTime,
                                          bool recordGCEndTime,
                                          bool countCollection) {
   _fullGC = fullGC;
+  _allMemoryPoolsAffected = allMemoryPoolsAffected;
   _recordGCBeginTime = recordGCBeginTime;
   _recordPreGCUsage = recordPreGCUsage;
   _recordPeakUsage = recordPeakUsage;
   _recordPostGCUsage = recordPostGCUsage;
   _recordAccumulatedGCTime = recordAccumulatedGCTime;

@@ -614,7 +623,7 @@
                           _recordPreGCUsage, _recordPeakUsage);
 }
 
 TraceMemoryManagerStats::~TraceMemoryManagerStats() {
   MemoryService::gc_end(_fullGC, _recordPostGCUsage, _recordAccumulatedGCTime,
-                        _recordGCEndTime, _countCollection, _cause);
+                        _recordGCEndTime, _countCollection, _cause, _allMemoryPoolsAffected);
 }
< prev index next >