comparison src/share/vm/gc_implementation/shared/gcTrace.hpp @ 11113:2cbc8f3011a0

8015972: Refactor the sending of the object count after GC event Reviewed-by: brutisso, pliden
author ehelin
date Wed, 05 Jun 2013 09:44:03 +0200
parents f2110083203d
children 86e6d691f2e1
comparison
equal deleted inserted replaced
11088:ea4d24c1e0c6 11113:2cbc8f3011a0
28 #include "gc_interface/gcCause.hpp" 28 #include "gc_interface/gcCause.hpp"
29 #include "gc_interface/gcName.hpp" 29 #include "gc_interface/gcName.hpp"
30 #include "gc_implementation/shared/gcWhen.hpp" 30 #include "gc_implementation/shared/gcWhen.hpp"
31 #include "gc_implementation/shared/copyFailedInfo.hpp" 31 #include "gc_implementation/shared/copyFailedInfo.hpp"
32 #include "memory/allocation.hpp" 32 #include "memory/allocation.hpp"
33 #include "memory/klassInfoClosure.hpp"
34 #include "memory/referenceType.hpp" 33 #include "memory/referenceType.hpp"
35 #if INCLUDE_ALL_GCS 34 #if INCLUDE_ALL_GCS
36 #include "gc_implementation/g1/g1YCTypes.hpp" 35 #include "gc_implementation/g1/g1YCTypes.hpp"
37 #endif 36 #endif
38 #include "utilities/macros.hpp" 37 #include "utilities/macros.hpp"
111 }; 110 };
112 111
113 #endif // INCLUDE_ALL_GCS 112 #endif // INCLUDE_ALL_GCS
114 113
115 class GCTracer : public ResourceObj { 114 class GCTracer : public ResourceObj {
116 friend class ObjectCountEventSenderClosure;
117 protected: 115 protected:
118 SharedGCInfo _shared_gc_info; 116 SharedGCInfo _shared_gc_info;
119 117
120 public: 118 public:
121 void report_gc_start(GCCause::Cause cause, jlong timestamp); 119 void report_gc_start(GCCause::Cause cause, jlong timestamp);
122 void report_gc_end(jlong timestamp, TimePartitions* time_partitions); 120 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
123 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const; 121 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
124 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; 122 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
125 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN; 123 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
126
127 bool has_reported_gc_start() const; 124 bool has_reported_gc_start() const;
128 125
129 protected: 126 protected:
130 GCTracer(GCName name) : _shared_gc_info(name) {} 127 GCTracer(GCName name) : _shared_gc_info(name) {}
131 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp); 128 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
135 void send_garbage_collection_event() const; 132 void send_garbage_collection_event() const;
136 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const; 133 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
137 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; 134 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
138 void send_reference_stats_event(ReferenceType type, size_t count) const; 135 void send_reference_stats_event(ReferenceType type, size_t count) const;
139 void send_phase_events(TimePartitions* time_partitions) const; 136 void send_phase_events(TimePartitions* time_partitions) const;
140 void send_object_count_after_gc_event(Klass* klass, jlong count, julong total_size) const NOT_SERVICES_RETURN;
141 bool should_send_object_count_after_gc_event() const;
142 };
143
144 class ObjectCountEventSenderClosure : public KlassInfoClosure {
145 GCTracer* _gc_tracer;
146 const double _size_threshold_percentage;
147 const size_t _total_size_in_words;
148 public:
149 ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t total_size_in_words) :
150 _gc_tracer(gc_tracer),
151 _size_threshold_percentage(ObjectCountCutOffPercent / 100),
152 _total_size_in_words(total_size_in_words)
153 {}
154 virtual void do_cinfo(KlassInfoEntry* entry);
155 protected:
156 virtual void send_event(KlassInfoEntry* entry);
157 private:
158 bool should_send_event(KlassInfoEntry* entry) const;
159 }; 137 };
160 138
161 class YoungGCTracer : public GCTracer { 139 class YoungGCTracer : public GCTracer {
162 static const uint UNSET_TENURING_THRESHOLD = (uint) -1; 140 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
163 141