src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp
changeset 58863 c16ac7a2eba4
parent 57699 4aea554692aa
equal deleted inserted replaced
58861:2c3cc4b01880 58863:c16ac7a2eba4
    28 #include "jfr/periodic/sampling/jfrCallTrace.hpp"
    28 #include "jfr/periodic/sampling/jfrCallTrace.hpp"
    29 #include "jfr/periodic/sampling/jfrThreadSampler.hpp"
    29 #include "jfr/periodic/sampling/jfrThreadSampler.hpp"
    30 #include "jfr/recorder/service/jfrOptionSet.hpp"
    30 #include "jfr/recorder/service/jfrOptionSet.hpp"
    31 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
    31 #include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
    32 #include "jfr/support/jfrThreadId.hpp"
    32 #include "jfr/support/jfrThreadId.hpp"
       
    33 #include "jfr/support/jfrThreadLocal.hpp"
    33 #include "jfr/utilities/jfrTime.hpp"
    34 #include "jfr/utilities/jfrTime.hpp"
    34 #include "logging/log.hpp"
    35 #include "logging/log.hpp"
    35 #include "runtime/frame.inline.hpp"
    36 #include "runtime/frame.inline.hpp"
    36 #include "runtime/os.hpp"
    37 #include "runtime/os.hpp"
    37 #include "runtime/semaphore.hpp"
    38 #include "runtime/semaphore.hpp"
   350     MutexLocker ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
   351     MutexLocker ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
   351     JfrThreadSampler::transition_block()->notify_all();
   352     JfrThreadSampler::transition_block()->notify_all();
   352   }
   353   }
   353 }
   354 }
   354 
   355 
       
   356 static bool is_excluded(JavaThread* thread) {
       
   357   assert(thread != NULL, "invariant");
       
   358   return thread->is_hidden_from_external_view() || thread->in_deopt_handler() || thread->jfr_thread_local()->is_excluded();
       
   359 }
       
   360 
   355 bool JfrThreadSampleClosure::do_sample_thread(JavaThread* thread, JfrStackFrame* frames, u4 max_frames, JfrSampleType type) {
   361 bool JfrThreadSampleClosure::do_sample_thread(JavaThread* thread, JfrStackFrame* frames, u4 max_frames, JfrSampleType type) {
   356   assert(Threads_lock->owned_by_self(), "Holding the thread table lock.");
   362   assert(Threads_lock->owned_by_self(), "Holding the thread table lock.");
   357   if (thread->is_hidden_from_external_view() || thread->in_deopt_handler()) {
   363   if (is_excluded(thread)) {
   358     return false;
   364     return false;
   359   }
   365   }
   360 
   366 
   361   bool ret = false;
   367   bool ret = false;
   362   thread->set_trace_flag();  // Provides StoreLoad, needed to keep read of thread state from floating up.
   368   thread->set_trace_flag();  // Provides StoreLoad, needed to keep read of thread state from floating up.