< prev index next >

src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp

Print this page




 119       if (sample->has_thread_checkpoint()) {
 120         const JfrCheckpointBlobHandle& thread_cp = sample->thread_checkpoint();
 121         thread_cp->reset_write_state();
 122       }
 123       if (sample->has_klass_checkpoint()) {
 124         const JfrCheckpointBlobHandle& klass_cp = sample->klass_checkpoint();
 125         klass_cp->reset_write_state();
 126       }
 127     }
 128   }
 129 };
 130 
 131 class StackTraceWrite {
 132  private:
 133   JfrStackTraceRepository& _stack_trace_repo;
 134   JfrCheckpointWriter& _writer;
 135   int _count;
 136  public:
 137   StackTraceWrite(JfrStackTraceRepository& stack_trace_repo, JfrCheckpointWriter& writer) :
 138     _stack_trace_repo(stack_trace_repo), _writer(writer), _count(0) {
 139     JfrStacktrace_lock->lock();
 140   }
 141   ~StackTraceWrite() {
 142     assert(JfrStacktrace_lock->owned_by_self(), "invariant");
 143     JfrStacktrace_lock->unlock();
 144   }
 145 
 146   void sample_do(ObjectSample* sample) {
 147     assert(sample != NULL, "invariant");
 148     if (!sample->is_dead()) {
 149       if (sample->has_stack_trace()) {
 150         JfrTraceId::use(sample->klass(), true);
 151         _stack_trace_repo.write(_writer, sample->stack_trace_id(), sample->stack_trace_hash());
 152         ++_count;
 153       }
 154     }
 155   }
 156 
 157   int count() const {
 158     return _count;
 159   }




 119       if (sample->has_thread_checkpoint()) {
 120         const JfrCheckpointBlobHandle& thread_cp = sample->thread_checkpoint();
 121         thread_cp->reset_write_state();
 122       }
 123       if (sample->has_klass_checkpoint()) {
 124         const JfrCheckpointBlobHandle& klass_cp = sample->klass_checkpoint();
 125         klass_cp->reset_write_state();
 126       }
 127     }
 128   }
 129 };
 130 
 131 class StackTraceWrite {
 132  private:
 133   JfrStackTraceRepository& _stack_trace_repo;
 134   JfrCheckpointWriter& _writer;
 135   int _count;
 136  public:
 137   StackTraceWrite(JfrStackTraceRepository& stack_trace_repo, JfrCheckpointWriter& writer) :
 138     _stack_trace_repo(stack_trace_repo), _writer(writer), _count(0) {
 139     JfrStacktrace_lock->lock_without_safepoint_check();
 140   }
 141   ~StackTraceWrite() {
 142     assert(JfrStacktrace_lock->owned_by_self(), "invariant");
 143     JfrStacktrace_lock->unlock();
 144   }
 145 
 146   void sample_do(ObjectSample* sample) {
 147     assert(sample != NULL, "invariant");
 148     if (!sample->is_dead()) {
 149       if (sample->has_stack_trace()) {
 150         JfrTraceId::use(sample->klass(), true);
 151         _stack_trace_repo.write(_writer, sample->stack_trace_id(), sample->stack_trace_hash());
 152         ++_count;
 153       }
 154     }
 155   }
 156 
 157   int count() const {
 158     return _count;
 159   }


< prev index next >