< prev index next >

src/hotspot/share/jfr/leakprofiler/sampling/objectSample.hpp

Print this page

 41  * allocated, the thread and the stack trace.
 42  */
 43 class ObjectSample : public JfrCHeapObj {
 44   friend class ObjectSampler;
 45   friend class SampleList;
 46  private:
 47   ObjectSample* _next;
 48   ObjectSample* _previous;
 49   JfrBlobHandle _stacktrace;
 50   JfrBlobHandle _thread;
 51   JfrBlobHandle _type_set;
 52   WeakHandle    _object;
 53   Ticks _allocation_time;
 54   traceid _stack_trace_id;
 55   traceid _thread_id;
 56   int _index;
 57   size_t _span;
 58   size_t _allocated;
 59   size_t _heap_used_at_last_gc;
 60   unsigned int _stack_trace_hash;

 61 
 62   void release_references() {
 63     _stacktrace.~JfrBlobHandle();
 64     _thread.~JfrBlobHandle();
 65     _type_set.~JfrBlobHandle();
 66   }
 67 
 68   void reset();
 69 
 70  public:
 71   ObjectSample() : _next(NULL),
 72                    _previous(NULL),
 73                    _stacktrace(),
 74                    _thread(),
 75                    _type_set(),
 76                    _allocation_time(),
 77                    _stack_trace_id(0),
 78                    _thread_id(0),
 79                    _index(0),
 80                    _span(0),
 81                    _allocated(0),
 82                    _heap_used_at_last_gc(0),
 83                    _stack_trace_hash(0) {}

 84 
 85   ObjectSample* next() const {
 86     return _next;
 87   }
 88 
 89   void set_next(ObjectSample* next) {
 90     _next = next;
 91   }
 92 
 93   ObjectSample* prev() const {
 94     return _previous;
 95   }
 96 
 97   void set_prev(ObjectSample* prev) {
 98     _previous = prev;
 99   }
100 
101   bool is_dead() const;
102 
103   const oop object() const;

126   void add_span(size_t span) {
127     _span += span;
128   }
129 
130   size_t allocated() const {
131     return _allocated;
132   }
133 
134   void set_allocated(size_t size) {
135     _allocated = size;
136   }
137 
138   const Ticks& allocation_time() const {
139     return _allocation_time;
140   }
141 
142   const void set_allocation_time(const JfrTicks& time) {
143     _allocation_time = Ticks(time.value());
144   }
145 





146   void set_heap_used_at_last_gc(size_t heap_used) {
147     _heap_used_at_last_gc = heap_used;
148   }
149 
150   size_t heap_used_at_last_gc() const {
151     return _heap_used_at_last_gc;
152   }
153 
154   bool has_stack_trace_id() const {
155     return stack_trace_id() != 0;
156   }
157 
158   traceid stack_trace_id() const {
159     return _stack_trace_id;
160   }
161 
162   void set_stack_trace_id(traceid id) {
163     _stack_trace_id = id;
164   }
165 
166   unsigned int stack_trace_hash() const {
167     return _stack_trace_hash;
168   }
169 
170   void set_stack_trace_hash(unsigned int hash) {
171     _stack_trace_hash = hash;
172   }
173 
174   traceid thread_id() const {
175     return _thread_id;
176   }
177 
178   void set_thread_id(traceid id) {
179     _thread_id = id;
180   }
181 
182   bool is_alive_and_older_than(jlong time_stamp) const {
183     return !is_dead() && (JfrTime::is_ft_enabled() ?
184       _allocation_time.ft_value() : _allocation_time.value()) < time_stamp;
185   }
186 
187   const JfrBlobHandle& stacktrace() const {
188     return _stacktrace;
189   }
190 
191   bool has_stacktrace() const {
192     return _stacktrace.valid();
193   }
194 
195   // JfrBlobHandle assignment operator
196   // maintains proper reference counting
197   void set_stacktrace(const JfrBlobHandle& ref) {
198     if (_stacktrace != ref) {
199       _stacktrace = ref;
200     }
201   }
202 
203   const JfrBlobHandle& thread() const {
204     return _thread;
205   }
206 
207   bool has_thread() const {
208     return _thread.valid();
209   }
210 




211   void set_thread(const JfrBlobHandle& ref) {
212     if (_thread != ref) {
213       _thread = ref;
214     }
215   }
216 

















217   const JfrBlobHandle& type_set() const {
218     return _type_set;
219   }
220 
221   bool has_type_set() const {
222     return _type_set.valid();
223   }
224 
225   void set_type_set(const JfrBlobHandle& ref) {
226     if (_type_set != ref) {
227       if (_type_set.valid()) {
228         _type_set->set_next(ref);
229         return;
230       }
231       _type_set = ref;
232     }
233   }
234 };
235 
236 #endif // SHARE_JFR_LEAKPROFILER_SAMPLING_OBJECTSAMPLE_HPP

 41  * allocated, the thread and the stack trace.
 42  */
 43 class ObjectSample : public JfrCHeapObj {
 44   friend class ObjectSampler;
 45   friend class SampleList;
 46  private:
 47   ObjectSample* _next;
 48   ObjectSample* _previous;
 49   JfrBlobHandle _stacktrace;
 50   JfrBlobHandle _thread;
 51   JfrBlobHandle _type_set;
 52   WeakHandle    _object;
 53   Ticks _allocation_time;
 54   traceid _stack_trace_id;
 55   traceid _thread_id;
 56   int _index;
 57   size_t _span;
 58   size_t _allocated;
 59   size_t _heap_used_at_last_gc;
 60   unsigned int _stack_trace_hash;
 61   bool _virtual_thread;
 62 
 63   void release_references() {
 64     _stacktrace.~JfrBlobHandle();
 65     _thread.~JfrBlobHandle();
 66     _type_set.~JfrBlobHandle();
 67   }
 68 
 69   void reset();
 70 
 71  public:
 72   ObjectSample() : _next(NULL),
 73                    _previous(NULL),
 74                    _stacktrace(),
 75                    _thread(),
 76                    _type_set(),
 77                    _allocation_time(),
 78                    _stack_trace_id(0),
 79                    _thread_id(0),
 80                    _index(0),
 81                    _span(0),
 82                    _allocated(0),
 83                    _heap_used_at_last_gc(0),
 84                    _stack_trace_hash(0),
 85                    _virtual_thread(false) {}
 86 
 87   ObjectSample* next() const {
 88     return _next;
 89   }
 90 
 91   void set_next(ObjectSample* next) {
 92     _next = next;
 93   }
 94 
 95   ObjectSample* prev() const {
 96     return _previous;
 97   }
 98 
 99   void set_prev(ObjectSample* prev) {
100     _previous = prev;
101   }
102 
103   bool is_dead() const;
104 
105   const oop object() const;

128   void add_span(size_t span) {
129     _span += span;
130   }
131 
132   size_t allocated() const {
133     return _allocated;
134   }
135 
136   void set_allocated(size_t size) {
137     _allocated = size;
138   }
139 
140   const Ticks& allocation_time() const {
141     return _allocation_time;
142   }
143 
144   const void set_allocation_time(const JfrTicks& time) {
145     _allocation_time = Ticks(time.value());
146   }
147 
148   bool is_alive_and_older_than(jlong time_stamp) const {
149     return !is_dead() && (JfrTime::is_ft_enabled() ?
150       _allocation_time.ft_value() : _allocation_time.value()) < time_stamp;
151   }
152 
153   void set_heap_used_at_last_gc(size_t heap_used) {
154     _heap_used_at_last_gc = heap_used;
155   }
156 
157   size_t heap_used_at_last_gc() const {
158     return _heap_used_at_last_gc;
159   }
160 
161   bool has_stack_trace_id() const {
162     return stack_trace_id() != 0;
163   }
164 
165   traceid stack_trace_id() const {
166     return _stack_trace_id;
167   }
168 
169   void set_stack_trace_id(traceid id) {
170     _stack_trace_id = id;
171   }
172 
173   unsigned int stack_trace_hash() const {
174     return _stack_trace_hash;
175   }
176 
177   void set_stack_trace_hash(unsigned int hash) {
178     _stack_trace_hash = hash;
179   }
180 













181   const JfrBlobHandle& stacktrace() const {
182     return _stacktrace;
183   }
184 
185   bool has_stacktrace() const {
186     return _stacktrace.valid();
187   }
188 
189   // JfrBlobHandle assignment operator
190   // maintains proper reference counting
191   void set_stacktrace(const JfrBlobHandle& ref) {
192     if (_stacktrace != ref) {
193       _stacktrace = ref;
194     }
195   }
196 




197   bool has_thread() const {
198     return _thread.valid();
199   }
200 
201   const JfrBlobHandle& thread() const {
202     return _thread;
203   }
204 
205   void set_thread(const JfrBlobHandle& ref) {
206     if (_thread != ref) {
207       _thread = ref;
208     }
209   }
210 
211   traceid thread_id() const {
212     return _thread_id;
213   }
214 
215   void set_thread_id(traceid id) {
216     _thread_id = id;
217   }
218 
219   bool is_virtual_thread() const {
220     return _virtual_thread;
221   }
222 
223   void set_thread_is_virtual() {
224     assert(!_virtual_thread, "invariant");
225     _virtual_thread = true;
226   }
227 
228   const JfrBlobHandle& type_set() const {
229     return _type_set;
230   }
231 
232   bool has_type_set() const {
233     return _type_set.valid();
234   }
235 
236   void set_type_set(const JfrBlobHandle& ref) {
237     if (_type_set != ref) {
238       if (_type_set.valid()) {
239         _type_set->set_next(ref);
240         return;
241       }
242       _type_set = ref;
243     }
244   }
245 };
246 
247 #endif // SHARE_JFR_LEAKPROFILER_SAMPLING_OBJECTSAMPLE_HPP
< prev index next >