--- a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp Wed Oct 30 16:14:56 2019 +0100
+++ b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp Wed Oct 30 19:43:52 2019 +0100
@@ -30,6 +30,7 @@
#include "jfr/recorder/service/jfrOptionSet.hpp"
#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
#include "jfr/support/jfrThreadId.hpp"
+#include "jfr/support/jfrThreadLocal.hpp"
#include "jfr/utilities/jfrTime.hpp"
#include "logging/log.hpp"
#include "runtime/frame.inline.hpp"
@@ -352,9 +353,14 @@
}
}
+static bool is_excluded(JavaThread* thread) {
+ assert(thread != NULL, "invariant");
+ return thread->is_hidden_from_external_view() || thread->in_deopt_handler() || thread->jfr_thread_local()->is_excluded();
+}
+
bool JfrThreadSampleClosure::do_sample_thread(JavaThread* thread, JfrStackFrame* frames, u4 max_frames, JfrSampleType type) {
assert(Threads_lock->owned_by_self(), "Holding the thread table lock.");
- if (thread->is_hidden_from_external_view() || thread->in_deopt_handler()) {
+ if (is_excluded(thread)) {
return false;
}