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:
53 static const GCId UNSET_GCID = (GCId)-1;
54
55 private:
56 GCId _id;
57 GCName _name;
58 GCCause::Cause _cause;
59 jlong _start_timestamp;
60 jlong _end_timestamp;
61 jlong _sum_of_pauses;
62 jlong _longest_pause;
63
64 public:
65 SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
66 _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
67
68 void set_id(GCId id) { _id = id; }
69 GCId id() const { return _id; }
70
71 void set_start_timestamp(jlong timestamp) { _start_timestamp = timestamp; }
72 jlong start_timestamp() const { return _start_timestamp; }
73
74 void set_end_timestamp(jlong timestamp) { _end_timestamp = timestamp; }
75 jlong end_timestamp() const { return _end_timestamp; }
76
77 void set_name(GCName name) { _name = name; }
78 GCName name() const { return _name; }
79
80 void set_cause(GCCause::Cause cause) { _cause = cause; }
81 GCCause::Cause cause() const { return _cause; }
82
83 void set_sum_of_pauses(jlong duration) { _sum_of_pauses = duration; }
84 jlong sum_of_pauses() const { return _sum_of_pauses; }
85
86 void set_longest_pause(jlong duration) { _longest_pause = duration; }
87 jlong longest_pause() const { return _longest_pause; }
88 };
89
90 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
91 void* _dense_prefix;
92 public:
93 ParallelOldGCInfo() : _dense_prefix(NULL) {}
94 void report_dense_prefix(void* addr) {
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
157 class OldGCTracer : public GCTracer {
158 protected:
159 OldGCTracer(GCName name) : GCTracer(name) {}
160 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
161
162 public:
163 void report_concurrent_mode_failure();
164
165 private:
166 void send_old_gc_event() const;
167 void send_concurrent_mode_failure_event();
168 };
169
170 class ParallelOldTracer : public OldGCTracer {
171 ParallelOldGCInfo _parallel_old_gc_info;
172
173 public:
174 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
175 void report_dense_prefix(void* dense_prefix);
176
177 protected:
178 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
179
180 private:
181 void send_parallel_old_event() const;
182 };
183
184 class SerialOldTracer : public OldGCTracer {
185 public:
186 SerialOldTracer() : OldGCTracer(SerialOld) {}
187 };
188
189 class ParallelScavengeTracer : public YoungGCTracer {
190 public:
191 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}
192 };
193
194 class DefNewTracer : public YoungGCTracer {
195 public:
196 DefNewTracer() : YoungGCTracer(DefNew) {}
197 };
198
199 class ParNewTracer : public YoungGCTracer {
200 public:
201 ParNewTracer() : YoungGCTracer(ParNew) {}
202 };
203
204 #if INCLUDE_ALL_GCS
205 class G1NewTracer : public YoungGCTracer {
206 G1YoungGCInfo _g1_young_gc_info;
207
208 public:
209 G1NewTracer() : YoungGCTracer(G1New) {}
210
211 void report_yc_type(G1YCType type);
212 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
213 void report_evacuation_info(EvacuationInfo* info);
214 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
215
216 private:
217 void send_g1_young_gc_event();
218 void send_evacuation_info_event(EvacuationInfo* info);
219 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;
220 };
221 #endif
222
223 class CMSTracer : public OldGCTracer {
224 public:
225 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
226 };
227
228 class G1OldTracer : public OldGCTracer {
229 public:
230 G1OldTracer() : OldGCTracer(G1Old) {}
231 };
232
|
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 #include "utilities/ticks.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 public:
52 static const GCId UNSET_GCID = (GCId)-1;
53
54 private:
55 GCId _id;
56 GCName _name;
57 GCCause::Cause _cause;
58 Ticks _start_timestamp;
59 Ticks _end_timestamp;
60 Tickspan _sum_of_pauses;
61 Tickspan _longest_pause;
62
63 public:
64 SharedGCInfo(GCName name) :
65 _id(UNSET_GCID),
66 _name(name),
67 _cause(GCCause::_last_gc_cause),
68 _start_timestamp(),
69 _end_timestamp(),
70 _sum_of_pauses(),
71 _longest_pause() {
72 }
73
74 void set_id(GCId id) { _id = id; }
75 GCId id() const { return _id; }
76
77 void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
78 const Ticks start_timestamp() const { return _start_timestamp; }
79
80 void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
81 const Ticks end_timestamp() const { return _end_timestamp; }
82
83 void set_name(GCName name) { _name = name; }
84 GCName name() const { return _name; }
85
86 void set_cause(GCCause::Cause cause) { _cause = cause; }
87 GCCause::Cause cause() const { return _cause; }
88
89 void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }
90 const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
91
92 void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }
93 const Tickspan longest_pause() const { return _longest_pause; }
94 };
95
96 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
97 void* _dense_prefix;
98 public:
99 ParallelOldGCInfo() : _dense_prefix(NULL) {}
100 void report_dense_prefix(void* addr) {
101 _dense_prefix = addr;
102 }
103 void* dense_prefix() const { return _dense_prefix; }
104 };
105
106 #if INCLUDE_ALL_GCS
107
108 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
109 G1YCType _type;
110 public:
111 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
112 void set_type(G1YCType type) {
113 _type = type;
114 }
115 G1YCType type() const { return _type; }
116 };
117
118 #endif // INCLUDE_ALL_GCS
119
120 class GCTracer : public ResourceObj {
121 protected:
122 SharedGCInfo _shared_gc_info;
123
124 public:
125 void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);
126 void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);
127 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
128 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
129 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
130 bool has_reported_gc_start() const;
131
132 protected:
133 GCTracer(GCName name) : _shared_gc_info(name) {}
134 virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
135 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
136
137 private:
138 void send_garbage_collection_event() const;
139 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
140 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
141 void send_reference_stats_event(ReferenceType type, size_t count) const;
142 void send_phase_events(TimePartitions* time_partitions) const;
143 };
144
145 class YoungGCTracer : public GCTracer {
146 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
147
148 uint _tenuring_threshold;
149
150 protected:
151 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
152 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
153
154 public:
155 void report_promotion_failed(const PromotionFailedInfo& pf_info);
156 void report_tenuring_threshold(const uint tenuring_threshold);
157
158 private:
159 void send_young_gc_event() const;
160 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
161 };
162
163 class OldGCTracer : public GCTracer {
164 protected:
165 OldGCTracer(GCName name) : GCTracer(name) {}
166 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
167
168 public:
169 void report_concurrent_mode_failure();
170
171 private:
172 void send_old_gc_event() const;
173 void send_concurrent_mode_failure_event();
174 };
175
176 class ParallelOldTracer : public OldGCTracer {
177 ParallelOldGCInfo _parallel_old_gc_info;
178
179 public:
180 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
181 void report_dense_prefix(void* dense_prefix);
182
183 protected:
184 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
185
186 private:
187 void send_parallel_old_event() const;
188 };
189
190 class SerialOldTracer : public OldGCTracer {
191 public:
192 SerialOldTracer() : OldGCTracer(SerialOld) {}
193 };
194
195 class ParallelScavengeTracer : public YoungGCTracer {
196 public:
197 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}
198 };
199
200 class DefNewTracer : public YoungGCTracer {
201 public:
202 DefNewTracer() : YoungGCTracer(DefNew) {}
203 };
204
205 class ParNewTracer : public YoungGCTracer {
206 public:
207 ParNewTracer() : YoungGCTracer(ParNew) {}
208 };
209
210 #if INCLUDE_ALL_GCS
211 class G1NewTracer : public YoungGCTracer {
212 G1YoungGCInfo _g1_young_gc_info;
213
214 public:
215 G1NewTracer() : YoungGCTracer(G1New) {}
216
217 void report_yc_type(G1YCType type);
218 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
219 void report_evacuation_info(EvacuationInfo* info);
220 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
221
222 private:
223 void send_g1_young_gc_event();
224 void send_evacuation_info_event(EvacuationInfo* info);
225 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;
226 };
227 #endif
228
229 class CMSTracer : public OldGCTracer {
230 public:
231 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
232 };
233
234 class G1OldTracer : public OldGCTracer {
235 public:
236 G1OldTracer() : OldGCTracer(G1Old) {}
237 };
238
|