author | stuefe |
Tue, 26 Nov 2019 16:21:29 +0100 | |
branch | stuefe-new-metaspace-branch |
changeset 59272 | 54750b448264 |
parent 58063 | bdf136b8ae0e |
permissions | -rw-r--r-- |
18025 | 1 |
/* |
58002
01d31583f25c
8230431: Move G1 trace code from gcTrace* to G1 directory
sjohanss
parents:
53411
diff
changeset
|
2 |
* Copyright (c) 2012, 2019, 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" |
|
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58063
diff
changeset
|
33 |
#include "memory/metaspace.hpp" |
18025 | 34 |
#include "memory/heapInspection.hpp" |
29081
c61eb4914428
8072911: Remove includes of oop.inline.hpp from .hpp files
stefank
parents:
28940
diff
changeset
|
35 |
#include "memory/resourceArea.hpp" |
18706
2d278f82253d
8015683: object_count_after_gc should have the same timestamp for all events
ehelin
parents:
18705
diff
changeset
|
36 |
#include "runtime/os.hpp" |
18025 | 37 |
#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
|
38 |
#include "utilities/macros.hpp" |
50113 | 39 |
#include "utilities/ticks.hpp" |
18025 | 40 |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
41 |
void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) { |
18025 | 42 |
_shared_gc_info.set_cause(cause); |
43 |
_shared_gc_info.set_start_timestamp(timestamp); |
|
44 |
} |
|
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(GCCause::Cause cause, const Ticks& timestamp) { |
18025 | 47 |
report_gc_start_impl(cause, timestamp); |
48 |
} |
|
49 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
50 |
void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 51 |
_shared_gc_info.set_sum_of_pauses(time_partitions->sum_of_pauses()); |
52 |
_shared_gc_info.set_longest_pause(time_partitions->longest_pause()); |
|
53 |
_shared_gc_info.set_end_timestamp(timestamp); |
|
54 |
||
55 |
send_phase_events(time_partitions); |
|
56 |
send_garbage_collection_event(); |
|
57 |
} |
|
58 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
59 |
void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 60 |
report_gc_end_impl(timestamp, time_partitions); |
61 |
} |
|
62 |
||
63 |
void GCTracer::report_gc_reference_stats(const ReferenceProcessorStats& rps) const { |
|
64 |
send_reference_stats_event(REF_SOFT, rps.soft_count()); |
|
65 |
send_reference_stats_event(REF_WEAK, rps.weak_count()); |
|
66 |
send_reference_stats_event(REF_FINAL, rps.final_count()); |
|
67 |
send_reference_stats_event(REF_PHANTOM, rps.phantom_count()); |
|
68 |
} |
|
69 |
||
70 |
#if INCLUDE_SERVICES |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
71 |
class ObjectCountEventSenderClosure : public KlassInfoClosure { |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
72 |
const double _size_threshold_percentage; |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
73 |
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
|
74 |
const Ticks _timestamp; |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
75 |
|
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
76 |
public: |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32817
diff
changeset
|
77 |
ObjectCountEventSenderClosure(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
|
78 |
_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
|
79 |
_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
|
80 |
_timestamp(timestamp) |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
81 |
{} |
18025 | 82 |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
83 |
virtual void do_cinfo(KlassInfoEntry* entry) { |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
84 |
if (should_send_event(entry)) { |
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32817
diff
changeset
|
85 |
ObjectCountEventSender::send(entry, _timestamp); |
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
86 |
} |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
87 |
} |
18025 | 88 |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
89 |
private: |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
90 |
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
|
91 |
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
|
92 |
return percentage_of_heap >= _size_threshold_percentage; |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
93 |
} |
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
94 |
}; |
18025 | 95 |
|
96 |
void GCTracer::report_object_count_after_gc(BoolObjectClosure* is_alive_cl) { |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
97 |
assert(is_alive_cl != NULL, "Must supply function to check liveness"); |
18025 | 98 |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
99 |
if (ObjectCountEventSender::should_send_event()) { |
18025 | 100 |
ResourceMark rm; |
101 |
||
102 |
KlassInfoTable cit(false); |
|
103 |
if (!cit.allocation_failed()) { |
|
104 |
HeapInspection hi(false, false, false, NULL); |
|
105 |
hi.populate_table(&cit, is_alive_cl); |
|
33107
77bf0d2069a3
8134953: Make the GC ID available in a central place
brutisso
parents:
32817
diff
changeset
|
106 |
ObjectCountEventSenderClosure event_sender(cit.size_of_instances_in_words(), Ticks::now()); |
18025 | 107 |
cit.iterate(&event_sender); |
108 |
} |
|
109 |
} |
|
110 |
} |
|
18704
226ce98e75e6
8015972: Refactor the sending of the object count after GC event
ehelin
parents:
18025
diff
changeset
|
111 |
#endif // INCLUDE_SERVICES |
18025 | 112 |
|
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
113 |
void GCTracer::report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const { |
18025 | 114 |
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
|
115 |
} |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
116 |
|
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
117 |
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
|
118 |
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
|
119 |
|
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58063
diff
changeset
|
120 |
send_metaspace_chunk_free_list_summary(when, Metaspace::NonClassType, summary.metaspace_chunk_free_list_summary()); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
121 |
if (UseCompressedClassPointers) { |
59272
54750b448264
Metadatatype back to metaspace.hpp to reduce patch size
stuefe
parents:
58063
diff
changeset
|
122 |
send_metaspace_chunk_free_list_summary(when, Metaspace::ClassType, summary.class_chunk_free_list_summary()); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
123 |
} |
18025 | 124 |
} |
125 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
126 |
void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 127 |
assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported"); |
128 |
||
129 |
GCTracer::report_gc_end_impl(timestamp, time_partitions); |
|
130 |
send_young_gc_event(); |
|
131 |
||
132 |
_tenuring_threshold = UNSET_TENURING_THRESHOLD; |
|
133 |
} |
|
134 |
||
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
28024
diff
changeset
|
135 |
void YoungGCTracer::report_promotion_failed(const PromotionFailedInfo& pf_info) const { |
18025 | 136 |
send_promotion_failed_event(pf_info); |
137 |
} |
|
138 |
||
139 |
void YoungGCTracer::report_tenuring_threshold(const uint tenuring_threshold) { |
|
140 |
_tenuring_threshold = tenuring_threshold; |
|
141 |
} |
|
142 |
||
32608 | 143 |
bool YoungGCTracer::should_report_promotion_events() const { |
144 |
return should_report_promotion_in_new_plab_event() || |
|
145 |
should_report_promotion_outside_plab_event(); |
|
146 |
} |
|
147 |
||
28024 | 148 |
bool YoungGCTracer::should_report_promotion_in_new_plab_event() const { |
149 |
return should_send_promotion_in_new_plab_event(); |
|
150 |
} |
|
151 |
||
152 |
bool YoungGCTracer::should_report_promotion_outside_plab_event() const { |
|
153 |
return should_send_promotion_outside_plab_event(); |
|
154 |
} |
|
155 |
||
156 |
void YoungGCTracer::report_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
157 |
uint age, bool tenured, |
|
158 |
size_t plab_size) const { |
|
159 |
send_promotion_in_new_plab_event(klass, obj_size, age, tenured, plab_size); |
|
160 |
} |
|
161 |
||
162 |
void YoungGCTracer::report_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
163 |
uint age, bool tenured) const { |
|
164 |
send_promotion_outside_plab_event(klass, obj_size, age, tenured); |
|
165 |
} |
|
166 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
167 |
void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 168 |
GCTracer::report_gc_end_impl(timestamp, time_partitions); |
169 |
send_old_gc_event(); |
|
170 |
} |
|
171 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18706
diff
changeset
|
172 |
void ParallelOldTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) { |
18025 | 173 |
OldGCTracer::report_gc_end_impl(timestamp, time_partitions); |
174 |
send_parallel_old_event(); |
|
175 |
} |
|
176 |
||
177 |
void ParallelOldTracer::report_dense_prefix(void* dense_prefix) { |
|
178 |
_parallel_old_gc_info.report_dense_prefix(dense_prefix); |
|
179 |
} |
|
180 |
||
181 |
void OldGCTracer::report_concurrent_mode_failure() { |
|
182 |
send_concurrent_mode_failure_event(); |
|
183 |
} |