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