index

src/share/vm/gc_implementation/shared/vmGCOperations.cpp

Print this page
rev 8024 : imported patch event1
* * *
imported patch event2

@@ -198,10 +198,28 @@
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   GCCauseSetter gccs(gch, _gc_cause);
   gch->do_full_collection(gch->must_clear_all_soft_refs(), _max_level);
 }
 
+void VM_CollectForMetadataAllocation::doit_epilogue() {
+  AllocTracer::send_collect_for_allocation_event(_size * HeapWordSize, _gcid, _gc_attempt);
+  VM_GC_Operation::doit_epilogue();
+}
+
+VM_CollectForMetadataAllocation::VM_CollectForMetadataAllocation(ClassLoaderData* loader_data,
+                                                                 size_t size,
+                                                                 Metaspace::MetadataType mdtype,
+                                                                 uint gc_count_before,
+                                                                 uint full_gc_count_before,
+                                                                 GCCause::Cause gc_cause,
+                                                                 uint gc_attempt)
+    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
+      _loader_data(loader_data), _size(size), _mdtype(mdtype), _result(NULL), _gc_attempt(gc_attempt), _gcid(GCId::peek()) {
+  assert(_size != 0, "An allocation should always be requested with this operation.");
+  AllocTracer::send_allocation_requiring_gc_event(_size * HeapWordSize, _gcid, _gc_attempt);
+}
+
 // Returns true iff concurrent GCs unloads metadata.
 bool VM_CollectForMetadataAllocation::initiate_concurrent_GC() {
 #if INCLUDE_ALL_GCS
   if (UseConcMarkSweepGC && CMSClassUnloadingEnabled) {
     MetaspaceGC::set_should_concurrent_collect(true);

@@ -302,5 +320,21 @@
 
   if (GC_locker::is_active_and_needs_gc()) {
     set_gc_locked();
   }
 }
+
+VM_CollectForAllocation::VM_CollectForAllocation(size_t word_size, uint gc_count_before, GCCause::Cause cause, uint gc_attempt)
+    : VM_GC_Operation(gc_count_before, cause), _result(NULL), _word_size(word_size), _gc_attempt(gc_attempt), _gcid(GCId::peek()) {
+  // Only report if operation was really caused by an allocation.
+  if (_word_size != 0) {
+    AllocTracer::send_allocation_requiring_gc_event(_word_size * HeapWordSize, _gcid, _gc_attempt);
+  }
+}
+
+void VM_CollectForAllocation::doit_epilogue() {
+  // Only report if operation was caused by an allocation.
+  if (_word_size != 0) {
+    AllocTracer::send_collect_for_allocation_event(_word_size * HeapWordSize, _gcid, _gc_attempt);
+  }
+  VM_GC_Operation::doit_epilogue();
+}
index