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

Thu, 12 Oct 2017 21:27:07 +0800

author
aoqi
date
Thu, 12 Oct 2017 21:27:07 +0800
changeset 7535
7ae4e26cb1e0
parent 6904
0982ec23da03
parent 6876
710a3c8b516e
child 9931
fd44df5e3bc3
permissions
-rw-r--r--

merge

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

mercurial