8036696: Add metaspace gc threshold to metaspace summary trace event
authorehelin
Mon, 17 Mar 2014 17:31:46 +0100 (2014-03-17)
changeset 23464 ae470a2efd44
parent 23463 8a9ab140068a
child 23465 14790e4d53ec
8036696: Add metaspace gc threshold to metaspace summary trace event Reviewed-by: jmasa, stefank, mgerdin
hotspot/src/share/vm/gc_implementation/shared/gcHeapSummary.hpp
hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
hotspot/src/share/vm/gc_interface/collectedHeap.cpp
hotspot/src/share/vm/trace/trace.xml
--- a/hotspot/src/share/vm/gc_implementation/shared/gcHeapSummary.hpp	Mon Mar 17 15:18:45 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcHeapSummary.hpp	Mon Mar 17 17:31:46 2014 +0100
@@ -125,15 +125,17 @@
 };
 
 class MetaspaceSummary : public StackObj {
+  size_t _capacity_until_GC;
   MetaspaceSizes _meta_space;
   MetaspaceSizes _data_space;
   MetaspaceSizes _class_space;
 
  public:
-  MetaspaceSummary() : _meta_space(), _data_space(), _class_space() {}
-  MetaspaceSummary(const MetaspaceSizes& meta_space, const MetaspaceSizes& data_space, const MetaspaceSizes& class_space) :
-       _meta_space(meta_space), _data_space(data_space), _class_space(class_space) { }
+  MetaspaceSummary() : _capacity_until_GC(0), _meta_space(), _data_space(), _class_space() {}
+  MetaspaceSummary(size_t capacity_until_GC, const MetaspaceSizes& meta_space, const MetaspaceSizes& data_space, const MetaspaceSizes& class_space) :
+       _capacity_until_GC(capacity_until_GC), _meta_space(meta_space), _data_space(data_space), _class_space(class_space) { }
 
+  size_t capacity_until_GC() const { return _capacity_until_GC; }
   const MetaspaceSizes& meta_space() const { return _meta_space; }
   const MetaspaceSizes& data_space() const { return _data_space; }
   const MetaspaceSizes& class_space() const { return _class_space; }
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Mon Mar 17 15:18:45 2014 +0100
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Mon Mar 17 17:31:46 2014 +0100
@@ -246,6 +246,7 @@
   if (e.should_commit()) {
     e.set_gcId(_shared_gc_info.id());
     e.set_when((u1) when);
+    e.set_gcThreshold(meta_space_summary.capacity_until_GC());
     e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
     e.set_dataSpace(to_trace_struct(meta_space_summary.data_space()));
     e.set_classSpace(to_trace_struct(meta_space_summary.class_space()));
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Mon Mar 17 15:18:45 2014 +0100
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.cpp	Mon Mar 17 17:31:46 2014 +0100
@@ -97,7 +97,7 @@
       MetaspaceAux::allocated_used_bytes(Metaspace::ClassType),
       MetaspaceAux::reserved_bytes(Metaspace::ClassType));
 
-  return MetaspaceSummary(meta_space, data_space, class_space);
+  return MetaspaceSummary(MetaspaceGC::capacity_until_GC(), meta_space, data_space, class_space);
 }
 
 void CollectedHeap::print_heap_before_gc() {
--- a/hotspot/src/share/vm/trace/trace.xml	Mon Mar 17 15:18:45 2014 +0100
+++ b/hotspot/src/share/vm/trace/trace.xml	Mon Mar 17 17:31:46 2014 +0100
@@ -193,6 +193,7 @@
     <event id="MetaspaceSummary" path="vm/gc/heap/metaspace_summary" label="Metaspace Summary" is_instant="true">
       <value type="UINT" field="gcId" label="GC ID" relation="GC_ID"/>
       <value type="GCWHEN" field="when" label="When" />
+      <value type="BYTES64" field="gcThreshold" label="GC Threshold" />
       <structvalue type="MetaspaceSizes" field="metaspace" label="Total"/>
       <structvalue type="MetaspaceSizes" field="dataSpace" label="Data"/>
       <structvalue type="MetaspaceSizes" field="classSpace" label="Class"/>