src/hotspot/share/jfr/leakprofiler/checkpoint/objectSampleCheckpoint.cpp
branchJEP-349-branch
changeset 58823 6a21dba79b81
parent 58157 9dca61a7df19
equal deleted inserted replaced
58806:a7d850b47b19 58823:6a21dba79b81
    35 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
    35 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceId.inline.hpp"
    36 #include "jfr/recorder/service/jfrOptionSet.hpp"
    36 #include "jfr/recorder/service/jfrOptionSet.hpp"
    37 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
    37 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
    38 #include "jfr/utilities/jfrHashtable.hpp"
    38 #include "jfr/utilities/jfrHashtable.hpp"
    39 #include "jfr/utilities/jfrTypes.hpp"
    39 #include "jfr/utilities/jfrTypes.hpp"
       
    40 #include "runtime/mutexLocker.hpp"
    40 #include "runtime/safepoint.hpp"
    41 #include "runtime/safepoint.hpp"
    41 #include "runtime/thread.hpp"
    42 #include "runtime/thread.hpp"
    42 #include "utilities/growableArray.hpp"
    43 #include "utilities/growableArray.hpp"
    43 
    44 
    44 static bool predicate(GrowableArray<traceid>* set, traceid id) {
    45 static bool predicate(GrowableArray<traceid>* set, traceid id) {
   289   }
   290   }
   290 }
   291 }
   291 
   292 
   292 // caller needs ResourceMark
   293 // caller needs ResourceMark
   293 void ObjectSampleCheckpoint::on_rotation(const ObjectSampler* sampler, JfrStackTraceRepository& stack_trace_repo) {
   294 void ObjectSampleCheckpoint::on_rotation(const ObjectSampler* sampler, JfrStackTraceRepository& stack_trace_repo) {
       
   295   assert(JfrStream_lock->owned_by_self(), "invariant");
   294   assert(sampler != NULL, "invariant");
   296   assert(sampler != NULL, "invariant");
   295   assert(LeakProfiler::is_running(), "invariant");
   297   assert(LeakProfiler::is_running(), "invariant");
   296   install_stack_traces(sampler, stack_trace_repo);
   298   install_stack_traces(sampler, stack_trace_repo);
   297 }
   299 }
   298 
   300 
   395   cbw.set_reset();
   397   cbw.set_reset();
   396   iterate_samples(cbw, true);
   398   iterate_samples(cbw, true);
   397 }
   399 }
   398 
   400 
   399 void ObjectSampleCheckpoint::write(const ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread) {
   401 void ObjectSampleCheckpoint::write(const ObjectSampler* sampler, EdgeStore* edge_store, bool emit_all, Thread* thread) {
       
   402   assert_locked_or_safepoint(JfrStream_lock);
   400   assert(sampler != NULL, "invariant");
   403   assert(sampler != NULL, "invariant");
   401   assert(edge_store != NULL, "invariant");
   404   assert(edge_store != NULL, "invariant");
   402   assert(thread != NULL, "invariant");
   405   assert(thread != NULL, "invariant");
   403   write_sample_blobs(sampler, emit_all, thread);
   406   write_sample_blobs(sampler, emit_all, thread);
   404   // write reference chains
   407   // write reference chains