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 #if INCLUDE_ALL_GCS
36 #include "gc_implementation/g1/g1YCTypes.hpp"
37 #endif
38 #include "utilities/macros.hpp"
39
40 typedef uint GCId;
41
42 class EvacuationInfo;
43 class GCHeapSummary;
44 class MetaspaceSummary;
45 class PSHeapSummary;
46 class ReferenceProcessorStats;
47 class TimePartitions;
48 class BoolObjectClosure;
49
50 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
51 static const jlong UNSET_TIMESTAMP = -1;
52
53 public:
96 _dense_prefix = addr;
97 }
98 void* dense_prefix() const { return _dense_prefix; }
99 };
100
101 #if INCLUDE_ALL_GCS
102
103 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
104 G1YCType _type;
105 public:
106 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
107 void set_type(G1YCType type) {
108 _type = type;
109 }
110 G1YCType type() const { return _type; }
111 };
112
113 #endif // INCLUDE_ALL_GCS
114
115 class GCTracer : public ResourceObj {
116 friend class ObjectCountEventSenderClosure;
117 protected:
118 SharedGCInfo _shared_gc_info;
119
120 public:
121 void report_gc_start(GCCause::Cause cause, jlong timestamp);
122 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;
124 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
125 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
126
127 bool has_reported_gc_start() const;
128
129 protected:
130 GCTracer(GCName name) : _shared_gc_info(name) {}
131 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
132 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
133
134 private:
135 void send_garbage_collection_event() const;
136 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;
138 void send_reference_stats_event(ReferenceType type, size_t count) const;
139 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 };
160
161 class YoungGCTracer : public GCTracer {
162 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
163
164 uint _tenuring_threshold;
165
166 protected:
167 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
168 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
169
170 public:
171 void report_promotion_failed(const PromotionFailedInfo& pf_info);
172 void report_tenuring_threshold(const uint tenuring_threshold);
173
174 private:
175 void send_young_gc_event() const;
176 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
177 };
178
|
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 #if INCLUDE_ALL_GCS
35 #include "gc_implementation/g1/g1YCTypes.hpp"
36 #endif
37 #include "utilities/macros.hpp"
38
39 typedef uint GCId;
40
41 class EvacuationInfo;
42 class GCHeapSummary;
43 class MetaspaceSummary;
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:
95 _dense_prefix = addr;
96 }
97 void* dense_prefix() const { return _dense_prefix; }
98 };
99
100 #if INCLUDE_ALL_GCS
101
102 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
103 G1YCType _type;
104 public:
105 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
106 void set_type(G1YCType type) {
107 _type = type;
108 }
109 G1YCType type() const { return _type; }
110 };
111
112 #endif // INCLUDE_ALL_GCS
113
114 class GCTracer : public ResourceObj {
115 protected:
116 SharedGCInfo _shared_gc_info;
117
118 public:
119 void report_gc_start(GCCause::Cause cause, jlong timestamp);
120 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
121 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
122 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
123 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
124 bool has_reported_gc_start() const;
125
126 protected:
127 GCTracer(GCName name) : _shared_gc_info(name) {}
128 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
129 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
130
131 private:
132 void send_garbage_collection_event() const;
133 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
134 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
135 void send_reference_stats_event(ReferenceType type, size_t count) const;
136 void send_phase_events(TimePartitions* time_partitions) const;
137 };
138
139 class YoungGCTracer : public GCTracer {
140 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
141
142 uint _tenuring_threshold;
143
144 protected:
145 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
146 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
147
148 public:
149 void report_promotion_failed(const PromotionFailedInfo& pf_info);
150 void report_tenuring_threshold(const uint tenuring_threshold);
151
152 private:
153 void send_young_gc_event() const;
154 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
155 };
156
|