author | david |
Fri, 12 Jun 2015 12:55:32 +0200 | |
changeset 31344 | 2316eb7a0358 |
parent 30764 | fec48bf5a827 |
child 31619 | f27b8fcf4018 |
permissions | -rw-r--r-- |
18025 | 1 |
/* |
30764 | 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 |
||
30764 | 25 |
#ifndef SHARE_VM_GC_SHARED_GCTRACE_HPP |
26 |
#define SHARE_VM_GC_SHARED_GCTRACE_HPP |
|
18025 | 27 |
|
30764 | 28 |
#include "gc/shared/copyFailedInfo.hpp" |
29 |
#include "gc/shared/gcCause.hpp" |
|
30 |
#include "gc/shared/gcId.hpp" |
|
31 |
#include "gc/shared/gcName.hpp" |
|
32 |
#include "gc/shared/gcWhen.hpp" |
|
18025 | 33 |
#include "memory/allocation.hpp" |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
34 |
#include "memory/metaspace.hpp" |
18025 | 35 |
#include "memory/referenceType.hpp" |
27684
e0391b2bf625
8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents:
25350
diff
changeset
|
36 |
#include "utilities/macros.hpp" |
e0391b2bf625
8064581: Move INCLUDE_ALL_GCS include section to the end of the include list
stefank
parents:
25350
diff
changeset
|
37 |
#include "utilities/ticks.hpp" |
18025 | 38 |
#if INCLUDE_ALL_GCS |
30764 | 39 |
#include "gc/g1/g1YCTypes.hpp" |
18025 | 40 |
#endif |
41 |
||
42 |
class EvacuationInfo; |
|
43 |
class GCHeapSummary; |
|
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
44 |
class MetaspaceChunkFreeListSummary; |
18025 | 45 |
class MetaspaceSummary; |
46 |
class PSHeapSummary; |
|
31344
2316eb7a0358
8025608: GC trace events missing nursery size information
david
parents:
30764
diff
changeset
|
47 |
class G1HeapSummary; |
18025 | 48 |
class ReferenceProcessorStats; |
49 |
class TimePartitions; |
|
50 |
class BoolObjectClosure; |
|
51 |
||
52 |
class SharedGCInfo VALUE_OBJ_CLASS_SPEC { |
|
53 |
private: |
|
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
54 |
GCId _gc_id; |
18025 | 55 |
GCName _name; |
56 |
GCCause::Cause _cause; |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
57 |
Ticks _start_timestamp; |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
58 |
Ticks _end_timestamp; |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
59 |
Tickspan _sum_of_pauses; |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
60 |
Tickspan _longest_pause; |
18025 | 61 |
|
62 |
public: |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
63 |
SharedGCInfo(GCName name) : |
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
64 |
_gc_id(GCId::undefined()), |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
65 |
_name(name), |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
66 |
_cause(GCCause::_last_gc_cause), |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
67 |
_start_timestamp(), |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
68 |
_end_timestamp(), |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
69 |
_sum_of_pauses(), |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
70 |
_longest_pause() { |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
71 |
} |
18025 | 72 |
|
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
73 |
void set_gc_id(GCId gc_id) { _gc_id = gc_id; } |
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
74 |
const GCId& gc_id() const { return _gc_id; } |
18025 | 75 |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
76 |
void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; } |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
77 |
const Ticks start_timestamp() const { return _start_timestamp; } |
18025 | 78 |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
79 |
void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; } |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
80 |
const Ticks end_timestamp() const { return _end_timestamp; } |
18025 | 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 |
||
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
88 |
void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; } |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
89 |
const Tickspan sum_of_pauses() const { return _sum_of_pauses; } |
18025 | 90 |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
91 |
void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; } |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
92 |
const Tickspan longest_pause() const { return _longest_pause; } |
18025 | 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: |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
124 |
void report_gc_start(GCCause::Cause cause, const Ticks& timestamp); |
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
125 |
void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions); |
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
126 |
void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const; |
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
127 |
void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const; |
18025 | 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; |
|
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
131 |
const GCId& gc_id() { return _shared_gc_info.gc_id(); } |
18025 | 132 |
|
133 |
protected: |
|
134 |
GCTracer(GCName name) : _shared_gc_info(name) {} |
|
25350
6423a57e5451
8043607: Add a GC id as a log decoration similar to PrintGCTimeStamps
brutisso
parents:
23470
diff
changeset
|
135 |
void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp); |
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
136 |
virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
18025 | 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; |
|
23470
ff2a7ea4225d
8036703: Add trace event with statistics for the metaspace chunk free lists
ehelin
parents:
21767
diff
changeset
|
142 |
void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const; |
18025 | 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) {} |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
154 |
virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
18025 | 155 |
|
156 |
public: |
|
28940
c314cf1db3fa
8066566: Refactor ParNewGeneration to contain ParNewTracer
mlarsson
parents:
28024
diff
changeset
|
157 |
void report_promotion_failed(const PromotionFailedInfo& pf_info) const; |
18025 | 158 |
void report_tenuring_threshold(const uint tenuring_threshold); |
159 |
||
28024 | 160 |
/* |
161 |
* Methods for reporting Promotion in new or outside PLAB Events. |
|
162 |
* |
|
163 |
* The object age is always required as it is not certain that the mark word |
|
164 |
* of the oop can be trusted at this stage. |
|
165 |
* |
|
166 |
* obj_size is the size of the promoted object in bytes. |
|
167 |
* |
|
168 |
* tenured should be true if the object has been promoted to the old |
|
169 |
* space during this GC, if the object is copied to survivor space |
|
170 |
* from young space or survivor space (aging) tenured should be false. |
|
171 |
* |
|
172 |
* plab_size is the size of the newly allocated PLAB in bytes. |
|
173 |
*/ |
|
174 |
bool should_report_promotion_in_new_plab_event() const; |
|
175 |
bool should_report_promotion_outside_plab_event() const; |
|
176 |
void report_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
177 |
uint age, bool tenured, |
|
178 |
size_t plab_size) const; |
|
179 |
void report_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
180 |
uint age, bool tenured) const; |
|
181 |
||
18025 | 182 |
private: |
183 |
void send_young_gc_event() const; |
|
184 |
void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const; |
|
28024 | 185 |
bool should_send_promotion_in_new_plab_event() const; |
186 |
bool should_send_promotion_outside_plab_event() const; |
|
187 |
void send_promotion_in_new_plab_event(Klass* klass, size_t obj_size, |
|
188 |
uint age, bool tenured, |
|
189 |
size_t plab_size) const; |
|
190 |
void send_promotion_outside_plab_event(Klass* klass, size_t obj_size, |
|
191 |
uint age, bool tenured) const; |
|
18025 | 192 |
}; |
193 |
||
194 |
class OldGCTracer : public GCTracer { |
|
195 |
protected: |
|
196 |
OldGCTracer(GCName name) : GCTracer(name) {} |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
197 |
virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
18025 | 198 |
|
199 |
public: |
|
200 |
void report_concurrent_mode_failure(); |
|
201 |
||
202 |
private: |
|
203 |
void send_old_gc_event() const; |
|
204 |
void send_concurrent_mode_failure_event(); |
|
205 |
}; |
|
206 |
||
207 |
class ParallelOldTracer : public OldGCTracer { |
|
208 |
ParallelOldGCInfo _parallel_old_gc_info; |
|
209 |
||
210 |
public: |
|
211 |
ParallelOldTracer() : OldGCTracer(ParallelOld) {} |
|
212 |
void report_dense_prefix(void* dense_prefix); |
|
213 |
||
214 |
protected: |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
215 |
void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
18025 | 216 |
|
217 |
private: |
|
218 |
void send_parallel_old_event() const; |
|
219 |
}; |
|
220 |
||
221 |
class SerialOldTracer : public OldGCTracer { |
|
222 |
public: |
|
223 |
SerialOldTracer() : OldGCTracer(SerialOld) {} |
|
224 |
}; |
|
225 |
||
226 |
class ParallelScavengeTracer : public YoungGCTracer { |
|
227 |
public: |
|
228 |
ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {} |
|
229 |
}; |
|
230 |
||
231 |
class DefNewTracer : public YoungGCTracer { |
|
232 |
public: |
|
233 |
DefNewTracer() : YoungGCTracer(DefNew) {} |
|
234 |
}; |
|
235 |
||
236 |
class ParNewTracer : public YoungGCTracer { |
|
237 |
public: |
|
238 |
ParNewTracer() : YoungGCTracer(ParNew) {} |
|
239 |
}; |
|
240 |
||
241 |
#if INCLUDE_ALL_GCS |
|
242 |
class G1NewTracer : public YoungGCTracer { |
|
243 |
G1YoungGCInfo _g1_young_gc_info; |
|
244 |
||
245 |
public: |
|
246 |
G1NewTracer() : YoungGCTracer(G1New) {} |
|
247 |
||
248 |
void report_yc_type(G1YCType type); |
|
21767
41eaa9a17059
8028128: Add a type safe alternative for working with counter based data
mgronlun
parents:
18704
diff
changeset
|
249 |
void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions); |
18025 | 250 |
void report_evacuation_info(EvacuationInfo* info); |
251 |
void report_evacuation_failed(EvacuationFailedInfo& ef_info); |
|
252 |
||
253 |
private: |
|
254 |
void send_g1_young_gc_event(); |
|
255 |
void send_evacuation_info_event(EvacuationInfo* info); |
|
256 |
void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const; |
|
257 |
}; |
|
258 |
#endif |
|
259 |
||
260 |
class CMSTracer : public OldGCTracer { |
|
261 |
public: |
|
262 |
CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {} |
|
263 |
}; |
|
264 |
||
265 |
class G1OldTracer : public OldGCTracer { |
|
266 |
public: |
|
267 |
G1OldTracer() : OldGCTracer(G1Old) {} |
|
268 |
}; |
|
269 |
||
30764 | 270 |
#endif // SHARE_VM_GC_SHARED_GCTRACE_HPP |