src/share/vm/gc_implementation/shared/gcTrace.hpp

Fri, 21 Mar 2014 10:31:51 +0100

author
ehelin
date
Fri, 21 Mar 2014 10:31:51 +0100
changeset 6420
9fdaa79b0c27
parent 6131
86e6d691f2e1
child 6876
710a3c8b516e
child 6904
0982ec23da03
permissions
-rw-r--r--

8036703: Add trace event with statistics for the metaspace chunk free lists
Reviewed-by: stefank, mgerdin, coleenp, egahlin

sla@5237 1 /*
sla@5237 2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
sla@5237 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sla@5237 4 *
sla@5237 5 * This code is free software; you can redistribute it and/or modify it
sla@5237 6 * under the terms of the GNU General Public License version 2 only, as
sla@5237 7 * published by the Free Software Foundation.
sla@5237 8 *
sla@5237 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sla@5237 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sla@5237 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sla@5237 12 * version 2 for more details (a copy is included in the LICENSE file that
sla@5237 13 * accompanied this code).
sla@5237 14 *
sla@5237 15 * You should have received a copy of the GNU General Public License version
sla@5237 16 * 2 along with this work; if not, write to the Free Software Foundation,
sla@5237 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sla@5237 18 *
sla@5237 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sla@5237 20 * or visit www.oracle.com if you need additional information or have any
sla@5237 21 * questions.
sla@5237 22 *
sla@5237 23 */
sla@5237 24
sla@5237 25 #ifndef SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
sla@5237 26 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP
sla@5237 27
sla@5237 28 #include "gc_interface/gcCause.hpp"
sla@5237 29 #include "gc_interface/gcName.hpp"
sla@5237 30 #include "gc_implementation/shared/gcWhen.hpp"
sla@5237 31 #include "gc_implementation/shared/copyFailedInfo.hpp"
sla@5237 32 #include "memory/allocation.hpp"
ehelin@6420 33 #include "memory/metaspace.hpp"
sla@5237 34 #include "memory/referenceType.hpp"
sla@5237 35 #if INCLUDE_ALL_GCS
sla@5237 36 #include "gc_implementation/g1/g1YCTypes.hpp"
sla@5237 37 #endif
sla@5237 38 #include "utilities/macros.hpp"
mgronlun@6131 39 #include "utilities/ticks.hpp"
sla@5237 40
sla@5237 41 typedef uint GCId;
sla@5237 42
sla@5237 43 class EvacuationInfo;
sla@5237 44 class GCHeapSummary;
ehelin@6420 45 class MetaspaceChunkFreeListSummary;
sla@5237 46 class MetaspaceSummary;
sla@5237 47 class PSHeapSummary;
sla@5237 48 class ReferenceProcessorStats;
sla@5237 49 class TimePartitions;
sla@5237 50 class BoolObjectClosure;
sla@5237 51
sla@5237 52 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 53 public:
sla@5237 54 static const GCId UNSET_GCID = (GCId)-1;
sla@5237 55
sla@5237 56 private:
sla@5237 57 GCId _id;
sla@5237 58 GCName _name;
sla@5237 59 GCCause::Cause _cause;
mgronlun@6131 60 Ticks _start_timestamp;
mgronlun@6131 61 Ticks _end_timestamp;
mgronlun@6131 62 Tickspan _sum_of_pauses;
mgronlun@6131 63 Tickspan _longest_pause;
sla@5237 64
sla@5237 65 public:
mgronlun@6131 66 SharedGCInfo(GCName name) :
mgronlun@6131 67 _id(UNSET_GCID),
mgronlun@6131 68 _name(name),
mgronlun@6131 69 _cause(GCCause::_last_gc_cause),
mgronlun@6131 70 _start_timestamp(),
mgronlun@6131 71 _end_timestamp(),
mgronlun@6131 72 _sum_of_pauses(),
mgronlun@6131 73 _longest_pause() {
mgronlun@6131 74 }
sla@5237 75
sla@5237 76 void set_id(GCId id) { _id = id; }
sla@5237 77 GCId id() const { return _id; }
sla@5237 78
mgronlun@6131 79 void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
mgronlun@6131 80 const Ticks start_timestamp() const { return _start_timestamp; }
sla@5237 81
mgronlun@6131 82 void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
mgronlun@6131 83 const Ticks end_timestamp() const { return _end_timestamp; }
sla@5237 84
sla@5237 85 void set_name(GCName name) { _name = name; }
sla@5237 86 GCName name() const { return _name; }
sla@5237 87
sla@5237 88 void set_cause(GCCause::Cause cause) { _cause = cause; }
sla@5237 89 GCCause::Cause cause() const { return _cause; }
sla@5237 90
mgronlun@6131 91 void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }
mgronlun@6131 92 const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
sla@5237 93
mgronlun@6131 94 void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }
mgronlun@6131 95 const Tickspan longest_pause() const { return _longest_pause; }
sla@5237 96 };
sla@5237 97
sla@5237 98 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 99 void* _dense_prefix;
sla@5237 100 public:
sla@5237 101 ParallelOldGCInfo() : _dense_prefix(NULL) {}
sla@5237 102 void report_dense_prefix(void* addr) {
sla@5237 103 _dense_prefix = addr;
sla@5237 104 }
sla@5237 105 void* dense_prefix() const { return _dense_prefix; }
sla@5237 106 };
sla@5237 107
sla@5237 108 #if INCLUDE_ALL_GCS
sla@5237 109
sla@5237 110 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 111 G1YCType _type;
sla@5237 112 public:
sla@5237 113 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
sla@5237 114 void set_type(G1YCType type) {
sla@5237 115 _type = type;
sla@5237 116 }
sla@5237 117 G1YCType type() const { return _type; }
sla@5237 118 };
sla@5237 119
sla@5237 120 #endif // INCLUDE_ALL_GCS
sla@5237 121
sla@5237 122 class GCTracer : public ResourceObj {
sla@5237 123 protected:
sla@5237 124 SharedGCInfo _shared_gc_info;
sla@5237 125
sla@5237 126 public:
mgronlun@6131 127 void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);
mgronlun@6131 128 void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);
ehelin@6420 129 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
ehelin@6420 130 void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const;
sla@5237 131 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
sla@5237 132 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
sla@5237 133 bool has_reported_gc_start() const;
sla@5237 134
sla@5237 135 protected:
sla@5237 136 GCTracer(GCName name) : _shared_gc_info(name) {}
mgronlun@6131 137 virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
mgronlun@6131 138 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 139
sla@5237 140 private:
sla@5237 141 void send_garbage_collection_event() const;
sla@5237 142 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
sla@5237 143 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
ehelin@6420 144 void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const;
sla@5237 145 void send_reference_stats_event(ReferenceType type, size_t count) const;
sla@5237 146 void send_phase_events(TimePartitions* time_partitions) const;
sla@5237 147 };
sla@5237 148
sla@5237 149 class YoungGCTracer : public GCTracer {
sla@5237 150 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
sla@5237 151
sla@5237 152 uint _tenuring_threshold;
sla@5237 153
sla@5237 154 protected:
sla@5237 155 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
mgronlun@6131 156 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 157
sla@5237 158 public:
sla@5237 159 void report_promotion_failed(const PromotionFailedInfo& pf_info);
sla@5237 160 void report_tenuring_threshold(const uint tenuring_threshold);
sla@5237 161
sla@5237 162 private:
sla@5237 163 void send_young_gc_event() const;
sla@5237 164 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
sla@5237 165 };
sla@5237 166
sla@5237 167 class OldGCTracer : public GCTracer {
sla@5237 168 protected:
sla@5237 169 OldGCTracer(GCName name) : GCTracer(name) {}
mgronlun@6131 170 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 171
sla@5237 172 public:
sla@5237 173 void report_concurrent_mode_failure();
sla@5237 174
sla@5237 175 private:
sla@5237 176 void send_old_gc_event() const;
sla@5237 177 void send_concurrent_mode_failure_event();
sla@5237 178 };
sla@5237 179
sla@5237 180 class ParallelOldTracer : public OldGCTracer {
sla@5237 181 ParallelOldGCInfo _parallel_old_gc_info;
sla@5237 182
sla@5237 183 public:
sla@5237 184 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
sla@5237 185 void report_dense_prefix(void* dense_prefix);
sla@5237 186
sla@5237 187 protected:
mgronlun@6131 188 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 189
sla@5237 190 private:
sla@5237 191 void send_parallel_old_event() const;
sla@5237 192 };
sla@5237 193
sla@5237 194 class SerialOldTracer : public OldGCTracer {
sla@5237 195 public:
sla@5237 196 SerialOldTracer() : OldGCTracer(SerialOld) {}
sla@5237 197 };
sla@5237 198
sla@5237 199 class ParallelScavengeTracer : public YoungGCTracer {
sla@5237 200 public:
sla@5237 201 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}
sla@5237 202 };
sla@5237 203
sla@5237 204 class DefNewTracer : public YoungGCTracer {
sla@5237 205 public:
sla@5237 206 DefNewTracer() : YoungGCTracer(DefNew) {}
sla@5237 207 };
sla@5237 208
sla@5237 209 class ParNewTracer : public YoungGCTracer {
sla@5237 210 public:
sla@5237 211 ParNewTracer() : YoungGCTracer(ParNew) {}
sla@5237 212 };
sla@5237 213
sla@5237 214 #if INCLUDE_ALL_GCS
sla@5237 215 class G1NewTracer : public YoungGCTracer {
sla@5237 216 G1YoungGCInfo _g1_young_gc_info;
sla@5237 217
sla@5237 218 public:
sla@5237 219 G1NewTracer() : YoungGCTracer(G1New) {}
sla@5237 220
sla@5237 221 void report_yc_type(G1YCType type);
mgronlun@6131 222 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 223 void report_evacuation_info(EvacuationInfo* info);
sla@5237 224 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
sla@5237 225
sla@5237 226 private:
sla@5237 227 void send_g1_young_gc_event();
sla@5237 228 void send_evacuation_info_event(EvacuationInfo* info);
sla@5237 229 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;
sla@5237 230 };
sla@5237 231 #endif
sla@5237 232
sla@5237 233 class CMSTracer : public OldGCTracer {
sla@5237 234 public:
sla@5237 235 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
sla@5237 236 };
sla@5237 237
sla@5237 238 class G1OldTracer : public OldGCTracer {
sla@5237 239 public:
sla@5237 240 G1OldTracer() : OldGCTracer(G1Old) {}
sla@5237 241 };
sla@5237 242
sla@5237 243 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP

mercurial