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 #ifndef SERIALGC
35 #include "gc_implementation/g1/g1YCTypes.hpp"
36 #endif
37
38 typedef uint GCId;
39
40 class EvacuationInfo;
41 class GCHeapSummary;
42 class PermGenSummary;
43 class PSHeapSummary;
44 class ReferenceProcessorStats;
45 class TimePartitions;
46 class BoolObjectClosure;
47
48 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
49 static const jlong UNSET_TIMESTAMP = -1;
50
51 public:
52 static const GCId UNSET_GCID = (GCId)-1;
92 ParallelOldGCInfo() : _dense_prefix(NULL) {}
93 void report_dense_prefix(void* addr) {
94 _dense_prefix = addr;
95 }
96 void* dense_prefix() const { return _dense_prefix; }
97 };
98
99 #ifndef SERIALGC
100
101 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
102 G1YCType _type;
103 public:
104 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
105 void set_type(G1YCType type) {
106 _type = type;
107 }
108 G1YCType type() const { return _type; }
109 };
110
111 #endif // SERIALGC
112
113 class GCTracer : public ResourceObj {
114 friend class ObjectCountEventSenderClosure;
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 PermGenSummary& perm_gen_summary) const;
122 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
123 void report_object_count_after_gc(BoolObjectClosure* object_filter);
124
125 bool has_reported_gc_start() const;
126
127 protected:
128 GCTracer(GCName name) : _shared_gc_info(name) {}
129 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
130 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
131
|
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 #ifndef SERIALGC
36 #include "gc_implementation/g1/g1YCTypes.hpp"
37 #endif
38
39 typedef uint GCId;
40
41 class EvacuationInfo;
42 class GCHeapSummary;
43 class PermGenSummary;
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;
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 #ifndef SERIALGC
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 // SERIALGC
113
114 class ObjectCountEventSenderClosure : public KlassInfoClosure {
115 GCTracer* _gc_tracer;
116 const double _size_threshold_percentage;
117 const size_t _used_heap_in_words;
118 public:
119 ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t used_heap_in_words) :
120 _gc_tracer(gc_tracer),
121 _size_threshold_percentage(0.05),
122 _used_heap_in_words(used_heap_in_words)
123 {}
124 virtual void do_cinfo(KlassInfoEntry* entry);
125 protected:
126 virtual void send_event(KlassInfoEntry* entry);
127 private:
128 bool should_send_event(KlassInfoEntry* entry) const;
129 };
130
131 class ObjectCountFilter : public BoolObjectClosure {
132 BoolObjectClosure* _is_alive;
133 public:
134 ObjectCountFilter(BoolObjectClosure* is_alive = NULL) : _is_alive(is_alive) {}
135 bool do_object_b(oop obj);
136 void do_object(oop obj) { ShouldNotReachHere(); }
137 private:
138 bool is_externally_visible_klass(klassOop k) const;
139 };
140
141 class GCTracer : public ResourceObj {
142 friend class ObjectCountEventSenderClosure;
143 protected:
144 SharedGCInfo _shared_gc_info;
145
146 public:
147 void report_gc_start(GCCause::Cause cause, jlong timestamp);
148 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
149 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const PermGenSummary& perm_gen_summary) const;
150 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
151 void report_object_count_after_gc(BoolObjectClosure* object_filter);
152
153 bool has_reported_gc_start() const;
154
155 protected:
156 GCTracer(GCName name) : _shared_gc_info(name) {}
157 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
158 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
159
|