35 #include "memory/referenceType.hpp" 36 #include "utilities/macros.hpp" 37 #include "utilities/ticks.hpp" 38 #if INCLUDE_ALL_GCS 39 #include "gc/g1/g1YCTypes.hpp" 40 #endif 41 42 class EvacuationInfo; 43 class GCHeapSummary; 44 class MetaspaceChunkFreeListSummary; 45 class MetaspaceSummary; 46 class PSHeapSummary; 47 class G1HeapSummary; 48 class G1EvacSummary; 49 class ReferenceProcessorStats; 50 class TimePartitions; 51 class BoolObjectClosure; 52 53 class SharedGCInfo VALUE_OBJ_CLASS_SPEC { 54 private: 55 GCId _gc_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 _gc_id(GCId::undefined()), 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_gc_id(GCId gc_id) { _gc_id = gc_id; } 75 const GCId& gc_id() const { return _gc_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 { 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; 128 void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const; 129 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; 130 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN; 131 bool has_reported_gc_start() const; 132 const GCId& gc_id() { return _shared_gc_info.gc_id(); } 133 134 protected: 135 GCTracer(GCName name) : _shared_gc_info(name) {} 136 void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp); 137 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); 138 139 private: 140 void send_garbage_collection_event() const; 141 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const; 142 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; 143 void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const; 144 void send_reference_stats_event(ReferenceType type, size_t count) const; 145 void send_phase_events(TimePartitions* time_partitions) const; 146 }; 147 148 class YoungGCTracer : public GCTracer { 149 static const uint UNSET_TENURING_THRESHOLD = (uint) -1; 150 151 uint _tenuring_threshold; 152 225 SerialOldTracer() : OldGCTracer(SerialOld) {} 226 }; 227 228 class ParallelScavengeTracer : public YoungGCTracer { 229 public: 230 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {} 231 }; 232 233 class DefNewTracer : public YoungGCTracer { 234 public: 235 DefNewTracer() : YoungGCTracer(DefNew) {} 236 }; 237 238 class ParNewTracer : public YoungGCTracer { 239 public: 240 ParNewTracer() : YoungGCTracer(ParNew) {} 241 }; 242 243 #if INCLUDE_ALL_GCS 244 class G1MMUTracer : public AllStatic { 245 static void send_g1_mmu_event(const GCId& gcId, double timeSlice, double gcTime, double maxTime); 246 247 public: 248 static void report_mmu(const GCId& gcId, double timeSlice, double gcTime, double maxTime); 249 }; 250 251 class G1NewTracer : public YoungGCTracer { 252 G1YoungGCInfo _g1_young_gc_info; 253 254 public: 255 G1NewTracer() : YoungGCTracer(G1New) {} 256 257 void report_yc_type(G1YCType type); 258 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); 259 void report_evacuation_info(EvacuationInfo* info); 260 void report_evacuation_failed(EvacuationFailedInfo& ef_info); 261 262 void report_evacuation_statistics(const G1EvacSummary& young_summary, const G1EvacSummary& old_summary) const; 263 private: 264 void send_g1_young_gc_event(); 265 void send_evacuation_info_event(EvacuationInfo* info); 266 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const; 267 268 void send_young_evacuation_statistics(const G1EvacSummary& summary) const; | 35 #include "memory/referenceType.hpp" 36 #include "utilities/macros.hpp" 37 #include "utilities/ticks.hpp" 38 #if INCLUDE_ALL_GCS 39 #include "gc/g1/g1YCTypes.hpp" 40 #endif 41 42 class EvacuationInfo; 43 class GCHeapSummary; 44 class MetaspaceChunkFreeListSummary; 45 class MetaspaceSummary; 46 class PSHeapSummary; 47 class G1HeapSummary; 48 class G1EvacSummary; 49 class ReferenceProcessorStats; 50 class TimePartitions; 51 class BoolObjectClosure; 52 53 class SharedGCInfo VALUE_OBJ_CLASS_SPEC { 54 private: 55 GCName _name; 56 GCCause::Cause _cause; 57 Ticks _start_timestamp; 58 Ticks _end_timestamp; 59 Tickspan _sum_of_pauses; 60 Tickspan _longest_pause; 61 62 public: 63 SharedGCInfo(GCName name) : 64 _name(name), 65 _cause(GCCause::_last_gc_cause), 66 _start_timestamp(), 67 _end_timestamp(), 68 _sum_of_pauses(), 69 _longest_pause() { 70 } 71 72 void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; } 73 const Ticks start_timestamp() const { return _start_timestamp; } 74 75 void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; } 76 const Ticks end_timestamp() const { return _end_timestamp; } 77 78 void set_name(GCName name) { _name = name; } 79 GCName name() const { return _name; } 80 81 void set_cause(GCCause::Cause cause) { _cause = cause; } 82 GCCause::Cause cause() const { return _cause; } 83 84 void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; } 85 const Tickspan sum_of_pauses() const { return _sum_of_pauses; } 86 87 void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; } 88 const Tickspan longest_pause() const { return _longest_pause; } 89 }; 90 91 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC { 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 protected: 117 SharedGCInfo _shared_gc_info; 118 119 public: 120 void report_gc_start(GCCause::Cause cause, const Ticks& timestamp); 121 void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions); 122 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const; 123 void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_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 protected: 128 GCTracer(GCName name) : _shared_gc_info(name) {} 129 void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp); 130 virtual void report_gc_end_impl(const Ticks& 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_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; 136 void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const; 137 void send_reference_stats_event(ReferenceType type, size_t count) const; 138 void send_phase_events(TimePartitions* time_partitions) const; 139 }; 140 141 class YoungGCTracer : public GCTracer { 142 static const uint UNSET_TENURING_THRESHOLD = (uint) -1; 143 144 uint _tenuring_threshold; 145 218 SerialOldTracer() : OldGCTracer(SerialOld) {} 219 }; 220 221 class ParallelScavengeTracer : public YoungGCTracer { 222 public: 223 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {} 224 }; 225 226 class DefNewTracer : public YoungGCTracer { 227 public: 228 DefNewTracer() : YoungGCTracer(DefNew) {} 229 }; 230 231 class ParNewTracer : public YoungGCTracer { 232 public: 233 ParNewTracer() : YoungGCTracer(ParNew) {} 234 }; 235 236 #if INCLUDE_ALL_GCS 237 class G1MMUTracer : public AllStatic { 238 static void send_g1_mmu_event(double timeSlice, double gcTime, double maxTime); 239 240 public: 241 static void report_mmu(double timeSlice, double gcTime, double maxTime); 242 }; 243 244 class G1NewTracer : public YoungGCTracer { 245 G1YoungGCInfo _g1_young_gc_info; 246 247 public: 248 G1NewTracer() : YoungGCTracer(G1New) {} 249 250 void report_yc_type(G1YCType type); 251 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); 252 void report_evacuation_info(EvacuationInfo* info); 253 void report_evacuation_failed(EvacuationFailedInfo& ef_info); 254 255 void report_evacuation_statistics(const G1EvacSummary& young_summary, const G1EvacSummary& old_summary) const; 256 private: 257 void send_g1_young_gc_event(); 258 void send_evacuation_info_event(EvacuationInfo* info); 259 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const; 260 261 void send_young_evacuation_statistics(const G1EvacSummary& summary) const; |