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

Tue, 26 Nov 2013 14:35:38 +0100

author
sjohanss
date
Tue, 26 Nov 2013 14:35:38 +0100
changeset 6148
55a0da3d420b
parent 5386
2cbc8f3011a0
child 6131
86e6d691f2e1
permissions
-rw-r--r--

8027675: Full collections with Serial slower in JDK 8 compared to 7u40
Summary: Reduced the number of calls to follow_class_loader and instead marked and pushed the klass holder directly. Also removed unneeded calls to adjust_klass.
Reviewed-by: coleenp, jmasa, mgerdin, tschatzl

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"
sla@5237 33 #include "memory/referenceType.hpp"
sla@5237 34 #if INCLUDE_ALL_GCS
sla@5237 35 #include "gc_implementation/g1/g1YCTypes.hpp"
sla@5237 36 #endif
sla@5237 37 #include "utilities/macros.hpp"
sla@5237 38
sla@5237 39 typedef uint GCId;
sla@5237 40
sla@5237 41 class EvacuationInfo;
sla@5237 42 class GCHeapSummary;
sla@5237 43 class MetaspaceSummary;
sla@5237 44 class PSHeapSummary;
sla@5237 45 class ReferenceProcessorStats;
sla@5237 46 class TimePartitions;
sla@5237 47 class BoolObjectClosure;
sla@5237 48
sla@5237 49 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 50 static const jlong UNSET_TIMESTAMP = -1;
sla@5237 51
sla@5237 52 public:
sla@5237 53 static const GCId UNSET_GCID = (GCId)-1;
sla@5237 54
sla@5237 55 private:
sla@5237 56 GCId _id;
sla@5237 57 GCName _name;
sla@5237 58 GCCause::Cause _cause;
sla@5237 59 jlong _start_timestamp;
sla@5237 60 jlong _end_timestamp;
sla@5237 61 jlong _sum_of_pauses;
sla@5237 62 jlong _longest_pause;
sla@5237 63
sla@5237 64 public:
sla@5237 65 SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
sla@5237 66 _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
sla@5237 67
sla@5237 68 void set_id(GCId id) { _id = id; }
sla@5237 69 GCId id() const { return _id; }
sla@5237 70
sla@5237 71 void set_start_timestamp(jlong timestamp) { _start_timestamp = timestamp; }
sla@5237 72 jlong start_timestamp() const { return _start_timestamp; }
sla@5237 73
sla@5237 74 void set_end_timestamp(jlong timestamp) { _end_timestamp = timestamp; }
sla@5237 75 jlong end_timestamp() const { return _end_timestamp; }
sla@5237 76
sla@5237 77 void set_name(GCName name) { _name = name; }
sla@5237 78 GCName name() const { return _name; }
sla@5237 79
sla@5237 80 void set_cause(GCCause::Cause cause) { _cause = cause; }
sla@5237 81 GCCause::Cause cause() const { return _cause; }
sla@5237 82
sla@5237 83 void set_sum_of_pauses(jlong duration) { _sum_of_pauses = duration; }
sla@5237 84 jlong sum_of_pauses() const { return _sum_of_pauses; }
sla@5237 85
sla@5237 86 void set_longest_pause(jlong duration) { _longest_pause = duration; }
sla@5237 87 jlong longest_pause() const { return _longest_pause; }
sla@5237 88 };
sla@5237 89
sla@5237 90 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 91 void* _dense_prefix;
sla@5237 92 public:
sla@5237 93 ParallelOldGCInfo() : _dense_prefix(NULL) {}
sla@5237 94 void report_dense_prefix(void* addr) {
sla@5237 95 _dense_prefix = addr;
sla@5237 96 }
sla@5237 97 void* dense_prefix() const { return _dense_prefix; }
sla@5237 98 };
sla@5237 99
sla@5237 100 #if INCLUDE_ALL_GCS
sla@5237 101
sla@5237 102 class G1YoungGCInfo VALUE_OBJ_CLASS_SPEC {
sla@5237 103 G1YCType _type;
sla@5237 104 public:
sla@5237 105 G1YoungGCInfo() : _type(G1YCTypeEndSentinel) {}
sla@5237 106 void set_type(G1YCType type) {
sla@5237 107 _type = type;
sla@5237 108 }
sla@5237 109 G1YCType type() const { return _type; }
sla@5237 110 };
sla@5237 111
sla@5237 112 #endif // INCLUDE_ALL_GCS
sla@5237 113
sla@5237 114 class GCTracer : public ResourceObj {
sla@5237 115 protected:
sla@5237 116 SharedGCInfo _shared_gc_info;
sla@5237 117
sla@5237 118 public:
sla@5237 119 void report_gc_start(GCCause::Cause cause, jlong timestamp);
sla@5237 120 void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
sla@5237 121 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
sla@5237 122 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
sla@5237 123 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
sla@5237 124 bool has_reported_gc_start() const;
sla@5237 125
sla@5237 126 protected:
sla@5237 127 GCTracer(GCName name) : _shared_gc_info(name) {}
sla@5237 128 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
sla@5237 129 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
sla@5237 130
sla@5237 131 private:
sla@5237 132 void send_garbage_collection_event() const;
sla@5237 133 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
sla@5237 134 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
sla@5237 135 void send_reference_stats_event(ReferenceType type, size_t count) const;
sla@5237 136 void send_phase_events(TimePartitions* time_partitions) const;
sla@5237 137 };
sla@5237 138
sla@5237 139 class YoungGCTracer : public GCTracer {
sla@5237 140 static const uint UNSET_TENURING_THRESHOLD = (uint) -1;
sla@5237 141
sla@5237 142 uint _tenuring_threshold;
sla@5237 143
sla@5237 144 protected:
sla@5237 145 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
sla@5237 146 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
sla@5237 147
sla@5237 148 public:
sla@5237 149 void report_promotion_failed(const PromotionFailedInfo& pf_info);
sla@5237 150 void report_tenuring_threshold(const uint tenuring_threshold);
sla@5237 151
sla@5237 152 private:
sla@5237 153 void send_young_gc_event() const;
sla@5237 154 void send_promotion_failed_event(const PromotionFailedInfo& pf_info) const;
sla@5237 155 };
sla@5237 156
sla@5237 157 class OldGCTracer : public GCTracer {
sla@5237 158 protected:
sla@5237 159 OldGCTracer(GCName name) : GCTracer(name) {}
sla@5237 160 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
sla@5237 161
sla@5237 162 public:
sla@5237 163 void report_concurrent_mode_failure();
sla@5237 164
sla@5237 165 private:
sla@5237 166 void send_old_gc_event() const;
sla@5237 167 void send_concurrent_mode_failure_event();
sla@5237 168 };
sla@5237 169
sla@5237 170 class ParallelOldTracer : public OldGCTracer {
sla@5237 171 ParallelOldGCInfo _parallel_old_gc_info;
sla@5237 172
sla@5237 173 public:
sla@5237 174 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
sla@5237 175 void report_dense_prefix(void* dense_prefix);
sla@5237 176
sla@5237 177 protected:
sla@5237 178 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
sla@5237 179
sla@5237 180 private:
sla@5237 181 void send_parallel_old_event() const;
sla@5237 182 };
sla@5237 183
sla@5237 184 class SerialOldTracer : public OldGCTracer {
sla@5237 185 public:
sla@5237 186 SerialOldTracer() : OldGCTracer(SerialOld) {}
sla@5237 187 };
sla@5237 188
sla@5237 189 class ParallelScavengeTracer : public YoungGCTracer {
sla@5237 190 public:
sla@5237 191 ParallelScavengeTracer() : YoungGCTracer(ParallelScavenge) {}
sla@5237 192 };
sla@5237 193
sla@5237 194 class DefNewTracer : public YoungGCTracer {
sla@5237 195 public:
sla@5237 196 DefNewTracer() : YoungGCTracer(DefNew) {}
sla@5237 197 };
sla@5237 198
sla@5237 199 class ParNewTracer : public YoungGCTracer {
sla@5237 200 public:
sla@5237 201 ParNewTracer() : YoungGCTracer(ParNew) {}
sla@5237 202 };
sla@5237 203
sla@5237 204 #if INCLUDE_ALL_GCS
sla@5237 205 class G1NewTracer : public YoungGCTracer {
sla@5237 206 G1YoungGCInfo _g1_young_gc_info;
sla@5237 207
sla@5237 208 public:
sla@5237 209 G1NewTracer() : YoungGCTracer(G1New) {}
sla@5237 210
sla@5237 211 void report_yc_type(G1YCType type);
sla@5237 212 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
sla@5237 213 void report_evacuation_info(EvacuationInfo* info);
sla@5237 214 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
sla@5237 215
sla@5237 216 private:
sla@5237 217 void send_g1_young_gc_event();
sla@5237 218 void send_evacuation_info_event(EvacuationInfo* info);
sla@5237 219 void send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const;
sla@5237 220 };
sla@5237 221 #endif
sla@5237 222
sla@5237 223 class CMSTracer : public OldGCTracer {
sla@5237 224 public:
sla@5237 225 CMSTracer() : OldGCTracer(ConcurrentMarkSweep) {}
sla@5237 226 };
sla@5237 227
sla@5237 228 class G1OldTracer : public OldGCTracer {
sla@5237 229 public:
sla@5237 230 G1OldTracer() : OldGCTracer(G1Old) {}
sla@5237 231 };
sla@5237 232
sla@5237 233 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACE_HPP

mercurial