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/promotionFailedInfo.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 GCHeapSummary;
41 class PermGenSummary;
42 class PSHeapSummary;
43 class ReferenceProcessorStats;
44 class TimePartitions;
45
46 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
47 static const jlong UNSET_TIMESTAMP = -1;
48
49 public:
50 static const GCId UNSET_GCID = (GCId)-1;
51
52 private:
53 GCId _id;
54 GCName _name;
55 GCCause::Cause _cause;
56 jlong _start_timestamp;
57 jlong _end_timestamp;
58 jlong _sum_of_pauses;
59 jlong _longest_pause;
60
61 public:
62 SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
63 _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
64
92 _dense_prefix = addr;
93 }
94 void* dense_prefix() const { return _dense_prefix; }
95 };
96
97 #ifndef SERIALGC
98
99 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
100 G1YCType _type;
101 public:
102 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
103 void set_type(G1YCType type) {
104 _type = type;
105 }
106 G1YCType type() const { return _type; }
107 };
108
109 #endif // SERIALGC
110
111 class GCTracer : public ResourceObj {
112 protected:
113 SharedGCInfo _shared_gc_info;
114
115 public:
116 void report_gc_start(GCCause::Cause cause, jlong timestamp);
117 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
118 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const PermGenSummary& perm_gen_summary) const;
119 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
120
121 bool has_reported_gc_start() const;
122
123 protected:
124 GCTracer(GCName name) : _shared_gc_info(name) {}
125 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
126 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
127
128 private:
129 void send_garbage_collection_event() const;
130 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
131 void send_perm_gen_summary_event(GCWhen::Type when, const PermGenSummary& perm_gen_summary) const;
132 void send_reference_stats_event(ReferenceType type, size_t count) const;
133 void send_phase_events(TimePartitions* time_partitions) const;
134 };
135
136 class YoungGCTracer : public GCTracer {
137 protected:
138 YoungGCTracer(GCName name) : GCTracer(name) {}
139
140 public:
141 virtual void report_promotion_failed(const PromotionFailedInfo& pf_info);
142
143 protected:
144 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
145
146 private:
147 void send_young_gc_event() const;
148 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
149 };
150
151 class OldGCTracer : public GCTracer {
152 protected:
153 OldGCTracer(GCName name) : GCTracer(name) {}
|
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/promotionFailedInfo.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 GCHeapSummary;
41 class PermGenSummary;
42 class PSHeapSummary;
43 class ReferenceProcessorStats;
44 class TimePartitions;
45 class BoolObjectClosure;
46
47 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
48 static const jlong UNSET_TIMESTAMP = -1;
49
50 public:
51 static const GCId UNSET_GCID = (GCId)-1;
52
53 private:
54 GCId _id;
55 GCName _name;
56 GCCause::Cause _cause;
57 jlong _start_timestamp;
58 jlong _end_timestamp;
59 jlong _sum_of_pauses;
60 jlong _longest_pause;
61
62 public:
63 SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
64 _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
65
93 _dense_prefix = addr;
94 }
95 void* dense_prefix() const { return _dense_prefix; }
96 };
97
98 #ifndef SERIALGC
99
100 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
101 G1YCType _type;
102 public:
103 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
104 void set_type(G1YCType type) {
105 _type = type;
106 }
107 G1YCType type() const { return _type; }
108 };
109
110 #endif // SERIALGC
111
112 class GCTracer : public ResourceObj {
113 friend class ObjectCountEventSenderClosure;
114 protected:
115 SharedGCInfo _shared_gc_info;
116
117 public:
118 void report_gc_start(GCCause::Cause cause, jlong timestamp);
119 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
120 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const PermGenSummary& perm_gen_summary) const;
121 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
122 void report_object_count_after_gc(BoolObjectClosure* object_filter);
123
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_perm_gen_summary_event(GCWhen::Type when, const PermGenSummary& perm_gen_summary) const;
135 void send_reference_stats_event(ReferenceType type, size_t count) const;
136 void send_phase_events(TimePartitions* time_partitions) const;
137 void send_object_count_after_gc_event(klassOop klass, jlong count, julong total_size) const;
138 bool should_send_object_count_after_gc_event() const;
139 };
140
141 class YoungGCTracer : public GCTracer {
142 protected:
143 YoungGCTracer(GCName name) : GCTracer(name) {}
144
145 public:
146 virtual void report_promotion_failed(const PromotionFailedInfo& pf_info);
147
148 protected:
149 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
150
151 private:
152 void send_young_gc_event() const;
153 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
154 };
155
156 class OldGCTracer : public GCTracer {
157 protected:
158 OldGCTracer(GCName name) : GCTracer(name) {}
|