src/share/vm/gc_implementation/shared/gcTrace.hpp

Print this page
rev 4524 : 8012086: The object count event should only send events for instances occupying more than 0.5% of the heap
Reviewed-by: brutisso, jwilhelm


  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
  27 
  28 #include "gc_interface/gcCause.hpp"
  29 #include "gc_interface/gcName.hpp"
  30 #include "gc_implementation/shared/gcWhen.hpp"
  31 #include "gc_implementation/shared/copyFailedInfo.hpp"
  32 #include "memory/allocation.hpp"

  33 #include "memory/referenceType.hpp"
  34 #ifndef SERIALGC
  35 #include "gc_implementation/g1/g1YCTypes.hpp"
  36 #endif
  37 
  38 typedef uint GCId;
  39 
  40 class EvacuationInfo;
  41 class GCHeapSummary;
  42 class PermGenSummary;
  43 class PSHeapSummary;
  44 class ReferenceProcessorStats;
  45 class TimePartitions;
  46 class BoolObjectClosure;
  47 
  48 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
  49   static const jlong UNSET_TIMESTAMP = -1;
  50 
  51  public:
  52   static const GCId UNSET_GCID = (GCId)-1;


 122   void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
 123   void report_object_count_after_gc(BoolObjectClosure* object_filter);
 124 
 125   bool has_reported_gc_start() const;
 126 
 127  protected:
 128   GCTracer(GCName name) : _shared_gc_info(name) {}
 129   virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
 130   virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
 131 
 132  private:
 133   void send_garbage_collection_event() const;
 134   void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
 135   void send_perm_gen_summary_event(GCWhen::Type when, const PermGenSummary& perm_gen_summary) const;
 136   void send_reference_stats_event(ReferenceType type, size_t count) const;
 137   void send_phase_events(TimePartitions* time_partitions) const;
 138   void send_object_count_after_gc_event(klassOop klass, jlong count, julong total_size) const;
 139   bool should_send_object_count_after_gc_event() const;
 140 };
 141 



























 142 class YoungGCTracer : public GCTracer {
 143   static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
 144 
 145   uint _tenuring_threshold;
 146 
 147  protected:
 148   YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
 149   virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
 150 
 151  public:
 152   void report_promotion_failed(const PromotionFailedInfo& pf_info);
 153   void report_tenuring_threshold(const uint tenuring_threshold);
 154 
 155  private:
 156   void send_young_gc_event() const;
 157   void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
 158 };
 159 
 160 class OldGCTracer : public GCTracer {
 161  protected:




  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
  27 
  28 #include "gc_interface/gcCause.hpp"
  29 #include "gc_interface/gcName.hpp"
  30 #include "gc_implementation/shared/gcWhen.hpp"
  31 #include "gc_implementation/shared/copyFailedInfo.hpp"
  32 #include "memory/allocation.hpp"
  33 #include "memory/klassInfoClosure.hpp"
  34 #include "memory/referenceType.hpp"
  35 #ifndef SERIALGC
  36 #include "gc_implementation/g1/g1YCTypes.hpp"
  37 #endif
  38 
  39 typedef uint GCId;
  40 
  41 class EvacuationInfo;
  42 class GCHeapSummary;
  43 class PermGenSummary;
  44 class PSHeapSummary;
  45 class ReferenceProcessorStats;
  46 class TimePartitions;
  47 class BoolObjectClosure;
  48 
  49 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
  50   static const jlong UNSET_TIMESTAMP = -1;
  51 
  52  public:
  53   static const GCId UNSET_GCID = (GCId)-1;


 123   void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
 124   void report_object_count_after_gc(BoolObjectClosure* object_filter);
 125 
 126   bool has_reported_gc_start() const;
 127 
 128  protected:
 129   GCTracer(GCName name) : _shared_gc_info(name) {}
 130   virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
 131   virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
 132 
 133  private:
 134   void send_garbage_collection_event() const;
 135   void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
 136   void send_perm_gen_summary_event(GCWhen::Type when, const PermGenSummary& perm_gen_summary) const;
 137   void send_reference_stats_event(ReferenceType type, size_t count) const;
 138   void send_phase_events(TimePartitions* time_partitions) const;
 139   void send_object_count_after_gc_event(klassOop klass, jlong count, julong total_size) const;
 140   bool should_send_object_count_after_gc_event() const;
 141 };
 142 
 143 class ObjectCountEventSenderClosure : public KlassInfoClosure {
 144   GCTracer* _gc_tracer;
 145   const double _size_threshold_percentage;
 146   const size_t _total_size_in_words;
 147  public:
 148   ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t total_size_in_words) :
 149     _gc_tracer(gc_tracer),
 150     _size_threshold_percentage(ObjectCountCutOffPercent / 100),
 151     _total_size_in_words(total_size_in_words)
 152   {}
 153   virtual void do_cinfo(KlassInfoEntry* entry);
 154  protected:
 155   virtual void send_event(KlassInfoEntry* entry);
 156  private:
 157   bool should_send_event(KlassInfoEntry* entry) const;
 158 };
 159 
 160 class ObjectCountFilter : public BoolObjectClosure {
 161   BoolObjectClosure* _is_alive;
 162  public:
 163   ObjectCountFilter(BoolObjectClosure* is_alive = NULL) : _is_alive(is_alive) {}
 164   bool do_object_b(oop obj);
 165   void do_object(oop obj) { ShouldNotReachHere(); }
 166  private:
 167   bool is_externally_visible_klass(klassOop k) const;
 168 };
 169 
 170 class YoungGCTracer : public GCTracer {
 171   static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
 172 
 173   uint _tenuring_threshold;
 174 
 175  protected:
 176   YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
 177   virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
 178 
 179  public:
 180   void report_promotion_failed(const PromotionFailedInfo& pf_info);
 181   void report_tenuring_threshold(const uint tenuring_threshold);
 182 
 183  private:
 184   void send_young_gc_event() const;
 185   void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
 186 };
 187 
 188 class OldGCTracer : public GCTracer {
 189  protected: