comparison src/share/vm/gc_implementation/shared/gcTrace.hpp @ 13400:86e6d691f2e1

8028128: Add a type safe alternative for working with counter based data Reviewed-by: dholmes, egahlin
author mgronlun
date Sat, 23 Nov 2013 12:25:13 +0100
parents 2cbc8f3011a0
children 9fdaa79b0c27
comparison
equal deleted inserted replaced
13399:260ac69dc096 13400:86e6d691f2e1
33 #include "memory/referenceType.hpp" 33 #include "memory/referenceType.hpp"
34 #if INCLUDE_ALL_GCS 34 #if INCLUDE_ALL_GCS
35 #include "gc_implementation/g1/g1YCTypes.hpp" 35 #include "gc_implementation/g1/g1YCTypes.hpp"
36 #endif 36 #endif
37 #include "utilities/macros.hpp" 37 #include "utilities/macros.hpp"
38 #include "utilities/ticks.hpp"
38 39
39 typedef uint GCId; 40 typedef uint GCId;
40 41
41 class EvacuationInfo; 42 class EvacuationInfo;
42 class GCHeapSummary; 43 class GCHeapSummary;
45 class ReferenceProcessorStats; 46 class ReferenceProcessorStats;
46 class TimePartitions; 47 class TimePartitions;
47 class BoolObjectClosure; 48 class BoolObjectClosure;
48 49
49 class SharedGCInfo VALUE_OBJ_CLASS_SPEC { 50 class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
50 static const jlong UNSET_TIMESTAMP = -1;
51
52 public: 51 public:
53 static const GCId UNSET_GCID = (GCId)-1; 52 static const GCId UNSET_GCID = (GCId)-1;
54 53
55 private: 54 private:
56 GCId _id; 55 GCId _id;
57 GCName _name; 56 GCName _name;
58 GCCause::Cause _cause; 57 GCCause::Cause _cause;
59 jlong _start_timestamp; 58 Ticks _start_timestamp;
60 jlong _end_timestamp; 59 Ticks _end_timestamp;
61 jlong _sum_of_pauses; 60 Tickspan _sum_of_pauses;
62 jlong _longest_pause; 61 Tickspan _longest_pause;
63 62
64 public: 63 public:
65 SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause), 64 SharedGCInfo(GCName name) :
66 _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {} 65 _id(UNSET_GCID),
66 _name(name),
67 _cause(GCCause::_last_gc_cause),
68 _start_timestamp(),
69 _end_timestamp(),
70 _sum_of_pauses(),
71 _longest_pause() {
72 }
67 73
68 void set_id(GCId id) { _id = id; } 74 void set_id(GCId id) { _id = id; }
69 GCId id() const { return _id; } 75 GCId id() const { return _id; }
70 76
71 void set_start_timestamp(jlong timestamp) { _start_timestamp = timestamp; } 77 void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
72 jlong start_timestamp() const { return _start_timestamp; } 78 const Ticks start_timestamp() const { return _start_timestamp; }
73 79
74 void set_end_timestamp(jlong timestamp) { _end_timestamp = timestamp; } 80 void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
75 jlong end_timestamp() const { return _end_timestamp; } 81 const Ticks end_timestamp() const { return _end_timestamp; }
76 82
77 void set_name(GCName name) { _name = name; } 83 void set_name(GCName name) { _name = name; }
78 GCName name() const { return _name; } 84 GCName name() const { return _name; }
79 85
80 void set_cause(GCCause::Cause cause) { _cause = cause; } 86 void set_cause(GCCause::Cause cause) { _cause = cause; }
81 GCCause::Cause cause() const { return _cause; } 87 GCCause::Cause cause() const { return _cause; }
82 88
83 void set_sum_of_pauses(jlong duration) { _sum_of_pauses = duration; } 89 void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }
84 jlong sum_of_pauses() const { return _sum_of_pauses; } 90 const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
85 91
86 void set_longest_pause(jlong duration) { _longest_pause = duration; } 92 void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }
87 jlong longest_pause() const { return _longest_pause; } 93 const Tickspan longest_pause() const { return _longest_pause; }
88 }; 94 };
89 95
90 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC { 96 class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
91 void* _dense_prefix; 97 void* _dense_prefix;
92 public: 98 public:
114 class GCTracer : public ResourceObj { 120 class GCTracer : public ResourceObj {
115 protected: 121 protected:
116 SharedGCInfo _shared_gc_info; 122 SharedGCInfo _shared_gc_info;
117 123
118 public: 124 public:
119 void report_gc_start(GCCause::Cause cause, jlong timestamp); 125 void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);
120 void report_gc_end(jlong timestamp, TimePartitions* time_partitions); 126 void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);
121 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const; 127 void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
122 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const; 128 void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
123 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN; 129 void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
124 bool has_reported_gc_start() const; 130 bool has_reported_gc_start() const;
125 131
126 protected: 132 protected:
127 GCTracer(GCName name) : _shared_gc_info(name) {} 133 GCTracer(GCName name) : _shared_gc_info(name) {}
128 virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp); 134 virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
129 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions); 135 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
130 136
131 private: 137 private:
132 void send_garbage_collection_event() const; 138 void send_garbage_collection_event() const;
133 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const; 139 void send_gc_heap_summary_event(GCWhen::Type when, const GCHeapSummary& heap_summary) const;
134 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const; 140 void send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const;
141 147
142 uint _tenuring_threshold; 148 uint _tenuring_threshold;
143 149
144 protected: 150 protected:
145 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {} 151 YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
146 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions); 152 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
147 153
148 public: 154 public:
149 void report_promotion_failed(const PromotionFailedInfo& pf_info); 155 void report_promotion_failed(const PromotionFailedInfo& pf_info);
150 void report_tenuring_threshold(const uint tenuring_threshold); 156 void report_tenuring_threshold(const uint tenuring_threshold);
151 157
155 }; 161 };
156 162
157 class OldGCTracer : public GCTracer { 163 class OldGCTracer : public GCTracer {
158 protected: 164 protected:
159 OldGCTracer(GCName name) : GCTracer(name) {} 165 OldGCTracer(GCName name) : GCTracer(name) {}
160 virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions); 166 virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
161 167
162 public: 168 public:
163 void report_concurrent_mode_failure(); 169 void report_concurrent_mode_failure();
164 170
165 private: 171 private:
173 public: 179 public:
174 ParallelOldTracer() : OldGCTracer(ParallelOld) {} 180 ParallelOldTracer() : OldGCTracer(ParallelOld) {}
175 void report_dense_prefix(void* dense_prefix); 181 void report_dense_prefix(void* dense_prefix);
176 182
177 protected: 183 protected:
178 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions); 184 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
179 185
180 private: 186 private:
181 void send_parallel_old_event() const; 187 void send_parallel_old_event() const;
182 }; 188 };
183 189
207 213
208 public: 214 public:
209 G1NewTracer() : YoungGCTracer(G1New) {} 215 G1NewTracer() : YoungGCTracer(G1New) {}
210 216
211 void report_yc_type(G1YCType type); 217 void report_yc_type(G1YCType type);
212 void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions); 218 void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
213 void report_evacuation_info(EvacuationInfo* info); 219 void report_evacuation_info(EvacuationInfo* info);
214 void report_evacuation_failed(EvacuationFailedInfo& ef_info); 220 void report_evacuation_failed(EvacuationFailedInfo& ef_info);
215 221
216 private: 222 private:
217 void send_g1_young_gc_event(); 223 void send_g1_young_gc_event();