< prev index next >
src/share/vm/jfr/leakprofiler/sampling/objectSampler.hpp
Print this page
rev 9055 : 8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
Reviewed-by: egahlin, rwestberg
*** 26,36 ****
--- 26,39 ----
#define SHARE_VM_LEAKPROFILER_SAMPLING_OBJECTSAMPLER_HPP
#include "memory/allocation.hpp"
#include "jfr/utilities/jfrTime.hpp"
+ typedef u8 traceid;
+
class BoolObjectClosure;
+ class JfrStackTrace;
class OopClosure;
class ObjectSample;
class ObjectSampler;
class SampleList;
class SamplePriorityQueue;
*** 38,73 ****
// Class reponsible for holding samples and
// making sure the samples are evenly distributed as
// new entries are added and removed.
class ObjectSampler : public CHeapObj<mtTracing> {
friend class LeakProfiler;
- friend class ObjectSampleCheckpoint;
friend class StartOperation;
friend class StopOperation;
! friend class EmitEventOperation;
private:
SamplePriorityQueue* _priority_queue;
SampleList* _list;
JfrTicks _last_sweep;
size_t _total_allocated;
size_t _threshold;
size_t _size;
- volatile int _tryLock;
bool _dead_samples;
explicit ObjectSampler(size_t size);
~ObjectSampler();
!
! void add(HeapWord* object, size_t size, JavaThread* thread);
! void remove_dead(ObjectSample* sample);
void scavenge();
// Called by GC
! void oops_do(BoolObjectClosure* is_alive, OopClosure* f);
- public:
const ObjectSample* item_at(int index) const;
ObjectSample* item_at(int index);
int item_count() const;
const ObjectSample* first() const;
const ObjectSample* last() const;
--- 41,91 ----
// Class reponsible for holding samples and
// making sure the samples are evenly distributed as
// new entries are added and removed.
class ObjectSampler : public CHeapObj<mtTracing> {
+ friend class EventEmitter;
+ friend class JfrRecorderService;
friend class LeakProfiler;
friend class StartOperation;
friend class StopOperation;
! friend class ObjectSampleCheckpoint;
! friend class WriteObjectSampleStacktrace;
private:
SamplePriorityQueue* _priority_queue;
SampleList* _list;
JfrTicks _last_sweep;
size_t _total_allocated;
size_t _threshold;
size_t _size;
bool _dead_samples;
+ // Lifecycle
explicit ObjectSampler(size_t size);
~ObjectSampler();
! static bool create(size_t size);
! static bool is_created();
! static ObjectSampler* sampler();
! static void destroy();
!
! // For operations that require exclusive access (non-safepoint)
! static ObjectSampler* acquire();
! static void release();
!
! // Stacktrace
! static void fill_stacktrace(JfrStackTrace* stacktrace, JavaThread* thread);
! traceid stacktrace_id(const JfrStackTrace* stacktrace, JavaThread* thread);
!
! // Sampling
! static void sample(HeapWord* object, size_t size, JavaThread* thread);
! void add(HeapWord* object, size_t size, traceid thread_id, JfrStackTrace* stacktrace, JavaThread* thread);
void scavenge();
+ void remove_dead(ObjectSample* sample);
// Called by GC
! static void oops_do(BoolObjectClosure* is_alive, OopClosure* f);
const ObjectSample* item_at(int index) const;
ObjectSample* item_at(int index);
int item_count() const;
const ObjectSample* first() const;
const ObjectSample* last() const;
< prev index next >