Mercurial > hg > graal-jvmci-8
annotate src/share/vm/gc_implementation/shared/gcTrace.hpp @ 22973:340ca8812af9
8067469: G1 ignores AlwaysPreTouch
Summary: Factor out pretouch code of the various virtual space management classes and use them everywhere including in G1.
Reviewed-by: stefank, ehelin, dholmes
author | tschatzl |
---|---|
date | Thu, 18 Dec 2014 09:37:02 +0100 |
parents | 0982ec23da03 |
children |
rev | line source |
---|---|
10405 | 1 /* |
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. | |
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 #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" | |
20190
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
30 #include "gc_implementation/shared/gcId.hpp" |
10405 | 31 #include "gc_implementation/shared/gcWhen.hpp" |
32 #include "gc_implementation/shared/copyFailedInfo.hpp" | |
33 #include "memory/allocation.hpp" | |
17771
9fdaa79b0c27
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
13400
diff
changeset
|
34 #include "memory/metaspace.hpp" |
10405 | 35 #include "memory/referenceType.hpp" |
36 #if INCLUDE_ALL_GCS | |
37 #include "gc_implementation/g1/g1YCTypes.hpp" | |
38 #endif | |
39 #include "utilities/macros.hpp" | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
40 #include "utilities/ticks.hpp" |
10405 | 41 |
42 | |
43 class EvacuationInfo; | |
44 class GCHeapSummary; | |
17771
9fdaa79b0c27
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
13400
diff
changeset
|
45 class MetaspaceChunkFreeListSummary; |
10405 | 46 class MetaspaceSummary; |
47 class PSHeapSummary; | |
48 class ReferenceProcessorStats; | |
49 class TimePartitions; | |
50 class BoolObjectClosure; | |
51 | |
52 class SharedGCInfo VALUE_OBJ_CLASS_SPEC { | |
53 private: | |
20190
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
54 GCId _gc_id; |
10405 | 55 GCName _name; |
56 GCCause::Cause _cause; | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
57 Ticks _start_timestamp; |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
58 Ticks _end_timestamp; |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
59 Tickspan _sum_of_pauses; |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
60 Tickspan _longest_pause; |
10405 | 61 |
62 public: | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
63 SharedGCInfo(GCName name) : |
20190
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
64 _gc_id(GCId::undefined()), |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
65 _name(name), |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
66 _cause(GCCause::_last_gc_cause), |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
67 _start_timestamp(), |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
68 _end_timestamp(), |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
69 _sum_of_pauses(), |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
70 _longest_pause() { |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
71 } |
10405 | 72 |
20190
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
73 void set_gc_id(GCId gc_id) { _gc_id = gc_id; } |
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
74 const GCId& gc_id() const { return _gc_id; } |
10405 | 75 |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
76 void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; } |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
77 const Ticks start_timestamp() const { return _start_timestamp; } |
10405 | 78 |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
79 void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; } |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
80 const Ticks end_timestamp() const { return _end_timestamp; } |
10405 | 81 |
82 void set_name(GCName name) { _name = name; } | |
83 GCName name() const { return _name; } | |
84 | |
85 void set_cause(GCCause::Cause cause) { _cause = cause; } | |
86 GCCause::Cause cause() const { return _cause; } | |
87 | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
88 void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; } |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
89 const Tickspan sum_of_pauses() const { return _sum_of_pauses; } |
10405 | 90 |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
91 void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; } |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
92 const Tickspan longest_pause() const { return _longest_pause; } |
10405 | 93 }; |
94 | |
95 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC { | |
96 void* _dense_prefix; | |
97 public: | |
98 ParallelOldGCInfo() : _dense_prefix(NULL) {} | |
99 void report_dense_prefix(void* addr) { | |
100 _dense_prefix = addr; | |
101 } | |
102 void* dense_prefix() const { return _dense_prefix; } | |
103 }; | |
104 | |
105 #if INCLUDE_ALL_GCS | |
106 | |
107 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC { | |
108 G1YCType _type; | |
109 public: | |
110 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {} | |
111 void set_type(G1YCType type) { | |
112 _type = type; | |
113 } | |
114 G1YCType type() const { return _type; } | |
115 }; | |
116 | |
117 #endif // INCLUDE_ALL_GCS | |
118 | |
119 class GCTracer : public ResourceObj { | |
120 protected: | |
121 SharedGCInfo _shared_gc_info; | |
122 | |
123 public: | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
124 void report_gc_start(GCCause::Cause cause, const Ticks& timestamp); |
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
125 void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions); |
17771
9fdaa79b0c27
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
13400
diff
changeset
|
126 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const; |
9fdaa79b0c27
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
13400
diff
changeset
|
127 void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const; |
10405 | 128 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; |
129 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN; | |
130 bool has_reported_gc_start() const; | |
20190
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
131 const GCId& gc_id() { return _shared_gc_info.gc_id(); } |
10405 | 132 |
133 protected: | |
134 GCTracer(GCName name) : _shared_gc_info(name) {} | |
20190
0982ec23da03
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
17771
diff
changeset
|
135 void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp); |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
136 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
10405 | 137 |
138 private: | |
139 void send_garbage_collection_event() const; | |
140 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const; | |
141 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; | |
17771
9fdaa79b0c27
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
13400
diff
changeset
|
142 void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const; |
10405 | 143 void send_reference_stats_event(ReferenceType type, size_t count) const; |
144 void send_phase_events(TimePartitions* time_partitions) const; | |
145 }; | |
146 | |
147 class YoungGCTracer : public GCTracer { | |
148 static const uint UNSET_TENURING_THRESHOLD = (uint) -1; | |
149 | |
150 uint _tenuring_threshold; | |
151 | |
152 protected: | |
153 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {} | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
154 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
10405 | 155 |
156 public: | |
157 void report_promotion_failed(const PromotionFailedInfo& pf_info); | |
158 void report_tenuring_threshold(const uint tenuring_threshold); | |
159 | |
160 private: | |
161 void send_young_gc_event() const; | |
162 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const; | |
163 }; | |
164 | |
165 class OldGCTracer : public GCTracer { | |
166 protected: | |
167 OldGCTracer(GCName name) : GCTracer(name) {} | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
168 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
10405 | 169 |
170 public: | |
171 void report_concurrent_mode_failure(); | |
172 | |
173 private: | |
174 void send_old_gc_event() const; | |
175 void send_concurrent_mode_failure_event(); | |
176 }; | |
177 | |
178 class ParallelOldTracer : public OldGCTracer { | |
179 ParallelOldGCInfo _parallel_old_gc_info; | |
180 | |
181 public: | |
182 ParallelOldTracer() : OldGCTracer(ParallelOld) {} | |
183 void report_dense_prefix(void* dense_prefix); | |
184 | |
185 protected: | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
186 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
10405 | 187 |
188 private: | |
189 void send_parallel_old_event() const; | |
190 }; | |
191 | |
192 class SerialOldTracer : public OldGCTracer { | |
193 public: | |
194 SerialOldTracer() : OldGCTracer(SerialOld) {} | |
195 }; | |
196 | |
197 class ParallelScavengeTracer : public YoungGCTracer { | |
198 public: | |
199 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {} | |
200 }; | |
201 | |
202 class DefNewTracer : public YoungGCTracer { | |
203 public: | |
204 DefNewTracer() : YoungGCTracer(DefNew) {} | |
205 }; | |
206 | |
207 class ParNewTracer : public YoungGCTracer { | |
208 public: | |
209 ParNewTracer() : YoungGCTracer(ParNew) {} | |
210 }; | |
211 | |
212 #if INCLUDE_ALL_GCS | |
213 class G1NewTracer : public YoungGCTracer { | |
214 G1YoungGCInfo _g1_young_gc_info; | |
215 | |
216 public: | |
217 G1NewTracer() : YoungGCTracer(G1New) {} | |
218 | |
219 void report_yc_type(G1YCType type); | |
13400
86e6d691f2e1
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
11113
diff
changeset
|
220 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
10405 | 221 void report_evacuation_info(EvacuationInfo* info); |
222 void report_evacuation_failed(EvacuationFailedInfo& ef_info); | |
223 | |
224 private: | |
225 void send_g1_young_gc_event(); | |
226 void send_evacuation_info_event(EvacuationInfo* info); | |
227 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const; | |
228 }; | |
229 #endif | |
230 | |
231 class CMSTracer : public OldGCTracer { | |
232 public: | |
233 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {} | |
234 }; | |
235 | |
236 class G1OldTracer : public OldGCTracer { | |
237 public: | |
238 G1OldTracer() : OldGCTracer(G1Old) {} | |
239 }; | |
240 | |
241 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP |