Print this page
rev 4524 : 8012086: The object count event should only send events for instances occupying more than 0.5% of the heap
Reviewed-by: brutisso, jwilhelm
Split |
Split |
Close |
Expand all |
Collapse all |
--- old/src/share/vm/gc_implementation/shared/gcTrace.hpp
+++ new/src/share/vm/gc_implementation/shared/gcTrace.hpp
1 1 /*
2 2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
3 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 4 *
5 5 * This code is free software; you can redistribute it and/or modify it
6 6 * under the terms of the GNU General Public License version 2 only, as
7 7 * published by the Free Software Foundation.
8 8 *
9 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 12 * version 2 for more details (a copy is included in the LICENSE file that
13 13 * accompanied this code).
14 14 *
15 15 * You should have received a copy of the GNU General Public License version
16 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 18 *
19 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 20 * or visit www.oracle.com if you need additional information or have any
21 21 * questions.
22 22 *
↓ open down ↓ |
22 lines elided |
↑ open up ↑ |
23 23 */
24 24
25 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
26 26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
27 27
28 28 #include "gc_interface/gcCause.hpp"
29 29 #include "gc_interface/gcName.hpp"
30 30 #include "gc_implementation/shared/gcWhen.hpp"
31 31 #include "gc_implementation/shared/copyFailedInfo.hpp"
32 32 #include "memory/allocation.hpp"
33 +#include "memory/klassInfoClosure.hpp"
33 34 #include "memory/referenceType.hpp"
34 35 #ifndef SERIALGC
35 36 #include "gc_implementation/g1/g1YCTypes.hpp"
36 37 #endif
37 38
38 39 typedef uint GCId;
39 40
40 41 class EvacuationInfo;
41 42 class GCHeapSummary;
42 43 class PermGenSummary;
43 44 class PSHeapSummary;
44 45 class ReferenceProcessorStats;
45 46 class TimePartitions;
46 47 class BoolObjectClosure;
47 48
48 49 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
49 50 static const jlong UNSET_TIMESTAMP = -1;
50 51
51 52 public:
52 53 static const GCId UNSET_GCID = (GCId)-1;
53 54
54 55 private:
55 56 GCId _id;
56 57 GCName _name;
57 58 GCCause::Cause _cause;
58 59 jlong _start_timestamp;
59 60 jlong _end_timestamp;
60 61 jlong _sum_of_pauses;
61 62 jlong _longest_pause;
62 63
63 64 public:
64 65 SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
65 66 _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
66 67
67 68 void set_id(GCId id) { _id = id; }
68 69 GCId id() const { return _id; }
69 70
70 71 void set_start_timestamp(jlong timestamp) { _start_timestamp = timestamp; }
71 72 jlong start_timestamp() const { return _start_timestamp; }
72 73
73 74 void set_end_timestamp(jlong timestamp) { _end_timestamp = timestamp; }
74 75 jlong end_timestamp() const { return _end_timestamp; }
75 76
76 77 void set_name(GCName name) { _name = name; }
77 78 GCName name() const { return _name; }
78 79
79 80 void set_cause(GCCause::Cause cause) { _cause = cause; }
80 81 GCCause::Cause cause() const { return _cause; }
81 82
82 83 void set_sum_of_pauses(jlong duration) { _sum_of_pauses = duration; }
83 84 jlong sum_of_pauses() const { return _sum_of_pauses; }
84 85
85 86 void set_longest_pause(jlong duration) { _longest_pause = duration; }
86 87 jlong longest_pause() const { return _longest_pause; }
87 88 };
88 89
89 90 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
90 91 void* _dense_prefix;
91 92 public:
92 93 ParallelOldGCInfo() : _dense_prefix(NULL) {}
93 94 void report_dense_prefix(void* addr) {
94 95 _dense_prefix = addr;
95 96 }
96 97 void* dense_prefix() const { return _dense_prefix; }
97 98 };
98 99
99 100 #ifndef SERIALGC
100 101
101 102 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
102 103 G1YCType _type;
103 104 public:
104 105 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
105 106 void set_type(G1YCType type) {
106 107 _type = type;
107 108 }
108 109 G1YCType type() const { return _type; }
109 110 };
110 111
111 112 #endif // SERIALGC
112 113
113 114 class GCTracer : public ResourceObj {
114 115 friend class ObjectCountEventSenderClosure;
115 116 protected:
116 117 SharedGCInfo _shared_gc_info;
117 118
118 119 public:
119 120 void report_gc_start(GCCause::Cause cause, jlong timestamp);
120 121 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
121 122 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const PermGenSummary& perm_gen_summary) const;
122 123 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
123 124 void report_object_count_after_gc(BoolObjectClosure* object_filter);
124 125
125 126 bool has_reported_gc_start() const;
126 127
127 128 protected:
128 129 GCTracer(GCName name) : _shared_gc_info(name) {}
129 130 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
130 131 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
131 132
↓ open down ↓ |
89 lines elided |
↑ open up ↑ |
132 133 private:
133 134 void send_garbage_collection_event() const;
134 135 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
135 136 void send_perm_gen_summary_event(GCWhen::Type when, const PermGenSummary& perm_gen_summary) const;
136 137 void send_reference_stats_event(ReferenceType type, size_t count) const;
137 138 void send_phase_events(TimePartitions* time_partitions) const;
138 139 void send_object_count_after_gc_event(klassOop klass, jlong count, julong total_size) const;
139 140 bool should_send_object_count_after_gc_event() const;
140 141 };
141 142
143 +class ObjectCountEventSenderClosure : public KlassInfoClosure {
144 + GCTracer* _gc_tracer;
145 + const double _size_threshold_percentage;
146 + const size_t _total_size_in_words;
147 + public:
148 + ObjectCountEventSenderClosure(GCTracer* gc_tracer, size_t total_size_in_words) :
149 + _gc_tracer(gc_tracer),
150 + _size_threshold_percentage(ObjectCountCutOffPercent / 100),
151 + _total_size_in_words(total_size_in_words)
152 + {}
153 + virtual void do_cinfo(KlassInfoEntry* entry);
154 + protected:
155 + virtual void send_event(KlassInfoEntry* entry);
156 + private:
157 + bool should_send_event(KlassInfoEntry* entry) const;
158 +};
159 +
160 +class ObjectCountFilter : public BoolObjectClosure {
161 + BoolObjectClosure* _is_alive;
162 + public:
163 + ObjectCountFilter(BoolObjectClosure* is_alive = NULL) : _is_alive(is_alive) {}
164 + bool do_object_b(oop obj);
165 + void do_object(oop obj) { ShouldNotReachHere(); }
166 + private:
167 + bool is_externally_visible_klass(klassOop k) const;
168 +};
169 +
142 170 class YoungGCTracer : public GCTracer {
143 171 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
144 172
145 173 uint _tenuring_threshold;
146 174
147 175 protected:
148 176 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
149 177 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
150 178
151 179 public:
152 180 void report_promotion_failed(const PromotionFailedInfo& pf_info);
153 181 void report_tenuring_threshold(const uint tenuring_threshold);
154 182
155 183 private:
156 184 void send_young_gc_event() const;
157 185 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
158 186 };
159 187
160 188 class OldGCTracer : public GCTracer {
161 189 protected:
162 190 OldGCTracer(GCName name) : GCTracer(name) {}
163 191 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
164 192
165 193 public:
166 194 void report_concurrent_mode_failure();
167 195
168 196 private:
169 197 void send_old_gc_event() const;
170 198 void send_concurrent_mode_failure_event();
171 199 };
172 200
173 201 class ParallelOldTracer : public OldGCTracer {
174 202 ParallelOldGCInfo _parallel_old_gc_info;
175 203
176 204 public:
177 205 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
178 206 void report_dense_prefix(void* dense_prefix);
179 207
180 208 protected:
181 209 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
182 210
183 211 private:
184 212 void send_parallel_old_event() const;
185 213 };
186 214
187 215 class SerialOldTracer : public OldGCTracer {
188 216 public:
189 217 SerialOldTracer() : OldGCTracer(SerialOld) {}
190 218 };
191 219
192 220 class ParallelScavengeTracer : public YoungGCTracer {
193 221 public:
194 222 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}
195 223 };
196 224
197 225 class DefNewTracer : public YoungGCTracer {
198 226 public:
199 227 DefNewTracer() : YoungGCTracer(DefNew) {}
200 228 };
201 229
202 230 class ParNewTracer : public YoungGCTracer {
203 231 public:
204 232 ParNewTracer() : YoungGCTracer(ParNew) {}
205 233 };
206 234
207 235 #ifndef SERIALGC
208 236 class G1NewTracer : public YoungGCTracer {
209 237 G1YoungGCInfo _g1_young_gc_info;
210 238
211 239 public:
212 240 G1NewTracer() : YoungGCTracer(G1New) {}
213 241
214 242 void report_yc_type(G1YCType type);
215 243 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
216 244 void report_evacuation_info(EvacuationInfo* info);
217 245 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
218 246
219 247 private:
220 248 void send_g1_young_gc_event();
221 249 void send_evacuation_info_event(EvacuationInfo* info);
222 250 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;
223 251 };
224 252 #endif
225 253
226 254 class CMSTracer : public OldGCTracer {
227 255 public:
228 256 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
229 257 };
230 258
231 259 class G1OldTracer : public OldGCTracer {
232 260 public:
233 261 G1OldTracer() : OldGCTracer(G1Old) {}
234 262 };
235 263
236 264 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
↓ open down ↓ |
85 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX