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

Mon, 12 Aug 2019 18:30:40 +0300

author
apetushkov
date
Mon, 12 Aug 2019 18:30:40 +0300
changeset 9858
b985cbb00e68
parent 6904
0982ec23da03
child 9931
fd44df5e3bc3
permissions
-rw-r--r--

8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling
8202835: jfr/event/os/TestSystemProcess.java fails on missing events
Summary: Backport JFR from JDK11. Initial integration
Reviewed-by: neugens

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"
brutisso@6904 30 #include "gc_implementation/shared/gcId.hpp"
sla@5237 31 #include "gc_implementation/shared/gcWhen.hpp"
sla@5237 32 #include "gc_implementation/shared/copyFailedInfo.hpp"
sla@5237 33 #include "memory/allocation.hpp"
ehelin@6420 34 #include "memory/metaspace.hpp"
sla@5237 35 #include "memory/referenceType.hpp"
sla@5237 36 #if INCLUDE_ALL_GCS
sla@5237 37 #include "gc_implementation/g1/g1YCTypes.hpp"
sla@5237 38 #endif
sla@5237 39 #include "utilities/macros.hpp"
mgronlun@6131 40 #include "utilities/ticks.hpp"
sla@5237 41
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 private:
brutisso@6904 54 GCId _gc_id;
sla@5237 55 GCName _name;
sla@5237 56 GCCause::Cause _cause;
mgronlun@6131 57 Ticks _start_timestamp;
mgronlun@6131 58 Ticks _end_timestamp;
mgronlun@6131 59 Tickspan _sum_of_pauses;
mgronlun@6131 60 Tickspan _longest_pause;
sla@5237 61
sla@5237 62 public:
mgronlun@6131 63 SharedGCInfo(GCName name) :
brutisso@6904 64 _gc_id(GCId::undefined()),
mgronlun@6131 65 _name(name),
mgronlun@6131 66 _cause(GCCause::_last_gc_cause),
mgronlun@6131 67 _start_timestamp(),
mgronlun@6131 68 _end_timestamp(),
mgronlun@6131 69 _sum_of_pauses(),
mgronlun@6131 70 _longest_pause() {
mgronlun@6131 71 }
sla@5237 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; }
sla@5237 75
mgronlun@6131 76 void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
mgronlun@6131 77 const Ticks start_timestamp() const { return _start_timestamp; }
sla@5237 78
mgronlun@6131 79 void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
mgronlun@6131 80 const Ticks end_timestamp() const { return _end_timestamp; }
sla@5237 81
sla@5237 82 void set_name(GCName name) { _name = name; }
sla@5237 83 GCName name() const { return _name; }
sla@5237 84
sla@5237 85 void set_cause(GCCause::Cause cause) { _cause = cause; }
sla@5237 86 GCCause::Cause cause() const { return _cause; }
sla@5237 87
mgronlun@6131 88 void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }
mgronlun@6131 89 const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
sla@5237 90
mgronlun@6131 91 void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }
mgronlun@6131 92 const Tickspan longest_pause() const { return _longest_pause; }
sla@5237 93 };
sla@5237 94
sla@5237 95 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 96 void* _dense_prefix;
sla@5237 97 public:
sla@5237 98 ParallelOldGCInfo() : _dense_prefix(NULL) {}
sla@5237 99 void report_dense_prefix(void* addr) {
sla@5237 100 _dense_prefix = addr;
sla@5237 101 }
sla@5237 102 void* dense_prefix() const { return _dense_prefix; }
sla@5237 103 };
sla@5237 104
sla@5237 105 #if INCLUDE_ALL_GCS
sla@5237 106
sla@5237 107 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 108 G1YCType _type;
sla@5237 109 public:
sla@5237 110 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
sla@5237 111 void set_type(G1YCType type) {
sla@5237 112 _type = type;
sla@5237 113 }
sla@5237 114 G1YCType type() const { return _type; }
sla@5237 115 };
sla@5237 116
sla@5237 117 #endif // INCLUDE_ALL_GCS
sla@5237 118
sla@5237 119 class GCTracer : public ResourceObj {
sla@5237 120 protected:
sla@5237 121 SharedGCInfo _shared_gc_info;
sla@5237 122
sla@5237 123 public:
mgronlun@6131 124 void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);
mgronlun@6131 125 void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);
ehelin@6420 126 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
ehelin@6420 127 void report_metaspace_summary(GCWhen::Type when, const MetaspaceSummary& metaspace_summary) const;
sla@5237 128 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
sla@5237 129 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
sla@5237 130 bool has_reported_gc_start() const;
brutisso@6904 131 const GCId& gc_id() { return _shared_gc_info.gc_id(); }
sla@5237 132
sla@5237 133 protected:
sla@5237 134 GCTracer(GCName name) : _shared_gc_info(name) {}
brutisso@6904 135 void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
mgronlun@6131 136 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 137
sla@5237 138 private:
sla@5237 139 void send_garbage_collection_event() const;
sla@5237 140 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
sla@5237 141 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
ehelin@6420 142 void send_metaspace_chunk_free_list_summary(GCWhen::Type when, Metaspace::MetadataType mdtype, const MetaspaceChunkFreeListSummary& summary) const;
sla@5237 143 void send_reference_stats_event(ReferenceType type, size_t count) const;
sla@5237 144 void send_phase_events(TimePartitions* time_partitions) const;
sla@5237 145 };
sla@5237 146
sla@5237 147 class YoungGCTracer : public GCTracer {
sla@5237 148 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
sla@5237 149
sla@5237 150 uint _tenuring_threshold;
sla@5237 151
sla@5237 152 protected:
sla@5237 153 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
mgronlun@6131 154 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 155
sla@5237 156 public:
sla@5237 157 void report_promotion_failed(const PromotionFailedInfo& pf_info);
sla@5237 158 void report_tenuring_threshold(const uint tenuring_threshold);
apetushkov@9858 159 /*
apetushkov@9858 160 * Methods for reporting Promotion in new or outside PLAB Events.
apetushkov@9858 161 *
apetushkov@9858 162 * The object age is always required as it is not certain that the mark word
apetushkov@9858 163 * of the oop can be trusted at this stage.
apetushkov@9858 164 *
apetushkov@9858 165 * obj_size is the size of the promoted object in bytes.
apetushkov@9858 166 *
apetushkov@9858 167 * tenured should be true if the object has been promoted to the old
apetushkov@9858 168 * space during this GC, if the object is copied to survivor space
apetushkov@9858 169 * from young space or survivor space (aging) tenured should be false.
apetushkov@9858 170 *
apetushkov@9858 171 * plab_size is the size of the newly allocated PLAB in bytes.
apetushkov@9858 172 */
apetushkov@9858 173 bool should_report_promotion_events() const;
apetushkov@9858 174 bool should_report_promotion_in_new_plab_event() const;
apetushkov@9858 175 bool should_report_promotion_outside_plab_event() const;
apetushkov@9858 176 void report_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
apetushkov@9858 177 uint age, bool tenured,
apetushkov@9858 178 size_t plab_size) const;
apetushkov@9858 179 void report_promotion_outside_plab_event(Klass* klass, size_t obj_size,
apetushkov@9858 180 uint age, bool tenured) const;
sla@5237 181
sla@5237 182 private:
sla@5237 183 void send_young_gc_event() const;
sla@5237 184 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
apetushkov@9858 185 bool should_send_promotion_in_new_plab_event() const;
apetushkov@9858 186 bool should_send_promotion_outside_plab_event() const;
apetushkov@9858 187 void send_promotion_in_new_plab_event(Klass* klass, size_t obj_size,
apetushkov@9858 188 uint age, bool tenured,
apetushkov@9858 189 size_t plab_size) const;
apetushkov@9858 190 void send_promotion_outside_plab_event(Klass* klass, size_t obj_size,
apetushkov@9858 191 uint age, bool tenured) const;
sla@5237 192 };
sla@5237 193
sla@5237 194 class OldGCTracer : public GCTracer {
sla@5237 195 protected:
sla@5237 196 OldGCTracer(GCName name) : GCTracer(name) {}
mgronlun@6131 197 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 198
sla@5237 199 public:
sla@5237 200 void report_concurrent_mode_failure();
sla@5237 201
sla@5237 202 private:
sla@5237 203 void send_old_gc_event() const;
sla@5237 204 void send_concurrent_mode_failure_event();
sla@5237 205 };
sla@5237 206
sla@5237 207 class ParallelOldTracer : public OldGCTracer {
sla@5237 208 ParallelOldGCInfo _parallel_old_gc_info;
sla@5237 209
sla@5237 210 public:
sla@5237 211 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
sla@5237 212 void report_dense_prefix(void* dense_prefix);
sla@5237 213
sla@5237 214 protected:
mgronlun@6131 215 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 216
sla@5237 217 private:
sla@5237 218 void send_parallel_old_event() const;
sla@5237 219 };
sla@5237 220
sla@5237 221 class SerialOldTracer : public OldGCTracer {
sla@5237 222 public:
sla@5237 223 SerialOldTracer() : OldGCTracer(SerialOld) {}
sla@5237 224 };
sla@5237 225
sla@5237 226 class ParallelScavengeTracer : public YoungGCTracer {
sla@5237 227 public:
sla@5237 228 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}
sla@5237 229 };
sla@5237 230
sla@5237 231 class DefNewTracer : public YoungGCTracer {
sla@5237 232 public:
sla@5237 233 DefNewTracer() : YoungGCTracer(DefNew) {}
sla@5237 234 };
sla@5237 235
sla@5237 236 class ParNewTracer : public YoungGCTracer {
sla@5237 237 public:
sla@5237 238 ParNewTracer() : YoungGCTracer(ParNew) {}
sla@5237 239 };
sla@5237 240
sla@5237 241 #if INCLUDE_ALL_GCS
apetushkov@9858 242 class G1MMUTracer : public AllStatic {
apetushkov@9858 243 static void send_g1_mmu_event(double time_slice_ms, double gc_time_ms, double max_time_ms);
apetushkov@9858 244
apetushkov@9858 245 public:
apetushkov@9858 246 static void report_mmu(double time_slice_sec, double gc_time_sec, double max_time_sec);
apetushkov@9858 247 };
apetushkov@9858 248
sla@5237 249 class G1NewTracer : public YoungGCTracer {
sla@5237 250 G1YoungGCInfo _g1_young_gc_info;
sla@5237 251
sla@5237 252 public:
sla@5237 253 G1NewTracer() : YoungGCTracer(G1New) {}
sla@5237 254
sla@5237 255 void report_yc_type(G1YCType type);
mgronlun@6131 256 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
sla@5237 257 void report_evacuation_info(EvacuationInfo* info);
sla@5237 258 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
sla@5237 259
sla@5237 260 private:
sla@5237 261 void send_g1_young_gc_event();
sla@5237 262 void send_evacuation_info_event(EvacuationInfo* info);
sla@5237 263 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;
sla@5237 264 };
sla@5237 265 #endif
sla@5237 266
sla@5237 267 class CMSTracer : public OldGCTracer {
sla@5237 268 public:
sla@5237 269 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
sla@5237 270 };
sla@5237 271
sla@5237 272 class G1OldTracer : public OldGCTracer {
sla@5237 273 public:
sla@5237 274 G1OldTracer() : OldGCTracer(G1Old) {}
sla@5237 275 };
sla@5237 276
sla@5237 277 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP

mercurial