author | tschatzl |
Wed, 02 Sep 2015 16:16:58 +0200 | |
changeset 32611 | 2d2320f70842 |
parent 32607 | c69a7b61ab02 |
parent 32608 | ef2ec6fac731 |
child 32817 | acc2744fd84b |
permissions | -rw-r--r-- |
18025 | 1 |
/* |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
2 |
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. |
18025 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
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 |
#include "precompiled.hpp" |
|
30764 | 26 |
#include "gc/shared/copyFailedInfo.hpp" |
27 |
#include "gc/shared/gcHeapSummary.hpp" |
|
28 |
#include "gc/shared/gcId.hpp" |
|
29 |
#include "gc/shared/gcTimer.hpp" |
|
30 |
#include "gc/shared/gcTrace.hpp" |
|
31 |
#include "gc/shared/objectCountEventSender.hpp" |
|
32 |
#include "gc/shared/referenceProcessorStats.hpp" |
|
18025 | 33 |
#include "memory/heapInspection.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
34 |
#include "memory/resourceArea.hpp" |
18706
2d278f82253d
8015683: object_count_after_gc should have the same timestamp for all events
ehelin
parents:
18705
diff
changeset
|
35 |
#include "runtime/os.hpp" |
18025 | 36 |
#include "utilities/globalDefinitions.hpp" |
27684
e0391b2bf625
8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents:
25350
diff
changeset
|
37 |
#include "utilities/macros.hpp" |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
38 |
#include "utilities/ticks.inline.hpp" |
18025 | 39 |
#if INCLUDE_ALL_GCS |
30764 | 40 |
#include "gc/g1/evacuationInfo.hpp" |
18025 | 41 |
#endif |
42 |
||
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
43 |
#define assert_unset_gc_id() assert(_shared_gc_info.gc_id().is_undefined(), "GC already started?") |
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
44 |
#define assert_set_gc_id() assert(!_shared_gc_info.gc_id().is_undefined(), "GC not started?") |
18025 | 45 |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
46 |
void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) { |
18025 | 47 |
assert_unset_gc_id(); |
48 |
||
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
49 |
GCId gc_id = GCId::create(); |
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
50 |
_shared_gc_info.set_gc_id(gc_id); |
18025 | 51 |
_shared_gc_info.set_cause(cause); |
52 |
_shared_gc_info.set_start_timestamp(timestamp); |
|
53 |
} |
|
54 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
55 |
void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) { |
18025 | 56 |
assert_unset_gc_id(); |
57 |
||
58 |
report_gc_start_impl(cause, timestamp); |
|
59 |
} |
|
60 |
||
61 |
bool GCTracer::has_reported_gc_start() const { |
|
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
62 |
return !_shared_gc_info.gc_id().is_undefined(); |
18025 | 63 |
} |
64 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
65 |
void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 66 |
assert_set_gc_id(); |
67 |
||
68 |
_shared_gc_info.set_sum_of_pauses(time_partitions->sum_of_pauses()); |
|
69 |
_shared_gc_info.set_longest_pause(time_partitions->longest_pause()); |
|
70 |
_shared_gc_info.set_end_timestamp(timestamp); |
|
71 |
||
72 |
send_phase_events(time_partitions); |
|
73 |
send_garbage_collection_event(); |
|
74 |
} |
|
75 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
76 |
void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 77 |
assert_set_gc_id(); |
78 |
||
79 |
report_gc_end_impl(timestamp, time_partitions); |
|
80 |
||
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
81 |
_shared_gc_info.set_gc_id(GCId::undefined()); |
18025 | 82 |
} |
83 |
||
84 |
void GCTracer::report_gc_reference_stats(const ReferenceProcessorStats& rps) const { |
|
85 |
assert_set_gc_id(); |
|
86 |
||
87 |
send_reference_stats_event(REF_SOFT, rps.soft_count()); |
|
88 |
send_reference_stats_event(REF_WEAK, rps.weak_count()); |
|
89 |
send_reference_stats_event(REF_FINAL, rps.final_count()); |
|
90 |
send_reference_stats_event(REF_PHANTOM, rps.phantom_count()); |
|
32607
c69a7b61ab02
8133818: Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
ysr
parents:
32380
diff
changeset
|
91 |
send_reference_stats_event(REF_CLEANER, rps.cleaner_count()); |
c69a7b61ab02
8133818: Additional number of processed references printed with -XX:+PrintReferenceGC after JDK-8047125
ysr
parents:
32380
diff
changeset
|
92 |
send_reference_stats_event(REF_JNI, rps.jni_weak_ref_count()); |
18025 | 93 |
} |
94 |
||
95 |
#if INCLUDE_SERVICES |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
96 |
class ObjectCountEventSenderClosure : public KlassInfoClosure { |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
97 |
const GCId _gc_id; |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
98 |
const double _size_threshold_percentage; |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
99 |
const size_t _total_size_in_words; |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
100 |
const Ticks _timestamp; |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
101 |
|
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
102 |
public: |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
103 |
ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, const Ticks& timestamp) : |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
104 |
_gc_id(gc_id), |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
105 |
_size_threshold_percentage(ObjectCountCutOffPercent / 100), |
18706
2d278f82253d
8015683: object_count_after_gc should have the same timestamp for all events
ehelin
parents:
18705
diff
changeset
|
106 |
_total_size_in_words(total_size_in_words), |
2d278f82253d
8015683: object_count_after_gc should have the same timestamp for all events
ehelin
parents:
18705
diff
changeset
|
107 |
_timestamp(timestamp) |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
108 |
{} |
18025 | 109 |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
110 |
virtual void do_cinfo(KlassInfoEntry* entry) { |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
111 |
if (should_send_event(entry)) { |
18706
2d278f82253d
8015683: object_count_after_gc should have the same timestamp for all events
ehelin
parents:
18705
diff
changeset
|
112 |
ObjectCountEventSender::send(entry, _gc_id, _timestamp); |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
113 |
} |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
114 |
} |
18025 | 115 |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
116 |
private: |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
117 |
bool should_send_event(const KlassInfoEntry* entry) const { |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
118 |
double percentage_of_heap = ((double) entry->words()) / _total_size_in_words; |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
119 |
return percentage_of_heap >= _size_threshold_percentage; |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
120 |
} |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
121 |
}; |
18025 | 122 |
|
123 |
void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) { |
|
124 |
assert_set_gc_id(); |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
125 |
assert(is_alive_cl != NULL, "Must supply function to check liveness"); |
18025 | 126 |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
127 |
if (ObjectCountEventSender::should_send_event()) { |
18025 | 128 |
ResourceMark rm; |
129 |
||
130 |
KlassInfoTable cit(false); |
|
131 |
if (!cit.allocation_failed()) { |
|
132 |
HeapInspection hi(false, false, false, NULL); |
|
133 |
hi.populate_table(&cit, is_alive_cl); |
|
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
134 |
ObjectCountEventSenderClosure event_sender(_shared_gc_info.gc_id(), cit.size_of_instances_in_words(), Ticks::now()); |
18025 | 135 |
cit.iterate(&event_sender); |
136 |
} |
|
137 |
} |
|
138 |
} |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
139 |
#endif // INCLUDE_SERVICES |
18025 | 140 |
|
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
141 |
void GCTracer::report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const { |
18025 | 142 |
assert_set_gc_id(); |
143 |
||
144 |
send_gc_heap_summary_event(when, heap_summary); |
|
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
145 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
146 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
147 |
void GCTracer::report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& summary) const { |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
148 |
assert_set_gc_id(); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
149 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
150 |
send_meta_space_summary_event(when, summary); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
151 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
152 |
send_metaspace_chunk_free_list_summary(when, Metaspace::NonClassType, summary.metaspace_chunk_free_list_summary()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
153 |
if (UseCompressedClassPointers) { |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
154 |
send_metaspace_chunk_free_list_summary(when, Metaspace::ClassType, summary.class_chunk_free_list_summary()); |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
155 |
} |
18025 | 156 |
} |
157 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
158 |
void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 159 |
assert_set_gc_id(); |
160 |
assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported"); |
|
161 |
||
162 |
GCTracer::report_gc_end_impl(timestamp, time_partitions); |
|
163 |
send_young_gc_event(); |
|
164 |
||
165 |
_tenuring_threshold = UNSET_TENURING_THRESHOLD; |
|
166 |
} |
|
167 |
||
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
28024
diff
changeset
|
168 |
void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) const { |
18025 | 169 |
assert_set_gc_id(); |
170 |
||
171 |
send_promotion_failed_event(pf_info); |
|
172 |
} |
|
173 |
||
174 |
void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) { |
|
175 |
_tenuring_threshold = tenuring_threshold; |
|
176 |
} |
|
177 |
||
32608 | 178 |
bool YoungGCTracer::should_report_promotion_events() const { |
179 |
return should_report_promotion_in_new_plab_event() || |
|
180 |
should_report_promotion_outside_plab_event(); |
|
181 |
} |
|
182 |
||
28024 | 183 |
bool YoungGCTracer::should_report_promotion_in_new_plab_event() const { |
184 |
return should_send_promotion_in_new_plab_event(); |
|
185 |
} |
|
186 |
||
187 |
bool YoungGCTracer::should_report_promotion_outside_plab_event() const { |
|
188 |
return should_send_promotion_outside_plab_event(); |
|
189 |
} |
|
190 |
||
191 |
void YoungGCTracer::report_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
192 |
uint age, bool tenured, |
|
193 |
size_t plab_size) const { |
|
194 |
assert_set_gc_id(); |
|
195 |
send_promotion_in_new_plab_event(klass, obj_size, age, tenured, plab_size); |
|
196 |
} |
|
197 |
||
198 |
void YoungGCTracer::report_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
199 |
uint age, bool tenured) const { |
|
200 |
assert_set_gc_id(); |
|
201 |
send_promotion_outside_plab_event(klass, obj_size, age, tenured); |
|
202 |
} |
|
203 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
204 |
void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 205 |
assert_set_gc_id(); |
206 |
||
207 |
GCTracer::report_gc_end_impl(timestamp, time_partitions); |
|
208 |
send_old_gc_event(); |
|
209 |
} |
|
210 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
211 |
void ParallelOldTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 212 |
assert_set_gc_id(); |
213 |
||
214 |
OldGCTracer::report_gc_end_impl(timestamp, time_partitions); |
|
215 |
send_parallel_old_event(); |
|
216 |
} |
|
217 |
||
218 |
void ParallelOldTracer::report_dense_prefix(void* dense_prefix) { |
|
219 |
assert_set_gc_id(); |
|
220 |
||
221 |
_parallel_old_gc_info.report_dense_prefix(dense_prefix); |
|
222 |
} |
|
223 |
||
224 |
void OldGCTracer::report_concurrent_mode_failure() { |
|
225 |
assert_set_gc_id(); |
|
226 |
||
227 |
send_concurrent_mode_failure_event(); |
|
228 |
} |
|
229 |
||
230 |
#if INCLUDE_ALL_GCS |
|
31619 | 231 |
void G1MMUTracer::report_mmu(const GCId& gcId, double timeSlice, double gcTime, double maxTime) { |
232 |
assert(!gcId.is_undefined(), "Undefined GC id"); |
|
233 |
||
234 |
send_g1_mmu_event(gcId, timeSlice, gcTime, maxTime); |
|
235 |
} |
|
236 |
||
18025 | 237 |
void G1NewTracer::report_yc_type(G1YCType type) { |
238 |
assert_set_gc_id(); |
|
239 |
||
240 |
_g1_young_gc_info.set_type(type); |
|
241 |
} |
|
242 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
243 |
void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 244 |
assert_set_gc_id(); |
245 |
||
246 |
YoungGCTracer::report_gc_end_impl(timestamp, time_partitions); |
|
247 |
send_g1_young_gc_event(); |
|
248 |
} |
|
249 |
||
250 |
void G1NewTracer::report_evacuation_info(EvacuationInfo* info) { |
|
251 |
assert_set_gc_id(); |
|
252 |
||
253 |
send_evacuation_info_event(info); |
|
254 |
} |
|
255 |
||
256 |
void G1NewTracer::report_evacuation_failed(EvacuationFailedInfo& ef_info) { |
|
257 |
assert_set_gc_id(); |
|
258 |
||
259 |
send_evacuation_failed_event(ef_info); |
|
260 |
ef_info.reset(); |
|
261 |
} |
|
32380
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
262 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
263 |
void G1NewTracer::report_evacuation_statistics(const G1EvacSummary& young_summary, const G1EvacSummary& old_summary) const { |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
264 |
assert_set_gc_id(); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
265 |
|
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
266 |
send_young_evacuation_statistics(young_summary); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
267 |
send_old_evacuation_statistics(old_summary); |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
268 |
} |
1dcdb686f0cb
8133530: Add JFR event for evacuation statistics
tschatzl
parents:
31619
diff
changeset
|
269 |
|
18025 | 270 |
#endif |