Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp
41155 views
1
/*
2
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*
23
*/
24
25
#include "precompiled.hpp"
26
#include "jfr/jfrEvents.hpp"
27
#include "jfr/recorder/jfrRecorder.hpp"
28
#include "jfr/periodic/sampling/jfrCallTrace.hpp"
29
#include "jfr/periodic/sampling/jfrThreadSampler.hpp"
30
#include "jfr/recorder/service/jfrOptionSet.hpp"
31
#include "jfr/recorder/stacktrace/jfrStackTraceRepository.hpp"
32
#include "jfr/support/jfrThreadId.hpp"
33
#include "jfr/support/jfrThreadLocal.hpp"
34
#include "jfr/utilities/jfrTime.hpp"
35
#include "jfrfiles/jfrEventClasses.hpp"
36
#include "logging/log.hpp"
37
#include "runtime/frame.inline.hpp"
38
#include "runtime/os.hpp"
39
#include "runtime/semaphore.hpp"
40
#include "runtime/thread.inline.hpp"
41
#include "runtime/threadSMR.hpp"
42
43
enum JfrSampleType {
44
NO_SAMPLE = 0,
45
JAVA_SAMPLE = 1,
46
NATIVE_SAMPLE = 2
47
};
48
49
static bool thread_state_in_java(JavaThread* thread) {
50
assert(thread != NULL, "invariant");
51
switch(thread->thread_state()) {
52
case _thread_new:
53
case _thread_uninitialized:
54
case _thread_new_trans:
55
case _thread_in_vm_trans:
56
case _thread_blocked_trans:
57
case _thread_in_native_trans:
58
case _thread_blocked:
59
case _thread_in_vm:
60
case _thread_in_native:
61
case _thread_in_Java_trans:
62
break;
63
case _thread_in_Java:
64
return true;
65
default:
66
ShouldNotReachHere();
67
break;
68
}
69
return false;
70
}
71
72
static bool thread_state_in_native(JavaThread* thread) {
73
assert(thread != NULL, "invariant");
74
switch(thread->thread_state()) {
75
case _thread_new:
76
case _thread_uninitialized:
77
case _thread_new_trans:
78
case _thread_blocked_trans:
79
case _thread_blocked:
80
case _thread_in_vm:
81
case _thread_in_vm_trans:
82
case _thread_in_Java_trans:
83
case _thread_in_Java:
84
case _thread_in_native_trans:
85
break;
86
case _thread_in_native:
87
return true;
88
default:
89
ShouldNotReachHere();
90
break;
91
}
92
return false;
93
}
94
95
class JfrThreadSampleClosure {
96
public:
97
JfrThreadSampleClosure(EventExecutionSample* events, EventNativeMethodSample* events_native);
98
~JfrThreadSampleClosure() {}
99
EventExecutionSample* next_event() { return &_events[_added_java++]; }
100
EventNativeMethodSample* next_event_native() { return &_events_native[_added_native++]; }
101
void commit_events(JfrSampleType type);
102
bool do_sample_thread(JavaThread* thread, JfrStackFrame* frames, u4 max_frames, JfrSampleType type);
103
uint java_entries() { return _added_java; }
104
uint native_entries() { return _added_native; }
105
106
private:
107
bool sample_thread_in_java(JavaThread* thread, JfrStackFrame* frames, u4 max_frames);
108
bool sample_thread_in_native(JavaThread* thread, JfrStackFrame* frames, u4 max_frames);
109
EventExecutionSample* _events;
110
EventNativeMethodSample* _events_native;
111
Thread* _self;
112
uint _added_java;
113
uint _added_native;
114
};
115
116
class OSThreadSampler : public os::SuspendedThreadTask {
117
public:
118
OSThreadSampler(JavaThread* thread,
119
JfrThreadSampleClosure& closure,
120
JfrStackFrame *frames,
121
u4 max_frames) : os::SuspendedThreadTask((Thread*)thread),
122
_success(false),
123
_thread_oop(thread->threadObj()),
124
_stacktrace(frames, max_frames),
125
_closure(closure),
126
_suspend_time() {}
127
128
void take_sample();
129
void do_task(const os::SuspendedThreadTaskContext& context);
130
void protected_task(const os::SuspendedThreadTaskContext& context);
131
bool success() const { return _success; }
132
const JfrStackTrace& stacktrace() const { return _stacktrace; }
133
134
private:
135
bool _success;
136
oop _thread_oop;
137
JfrStackTrace _stacktrace;
138
JfrThreadSampleClosure& _closure;
139
JfrTicks _suspend_time;
140
};
141
142
class OSThreadSamplerCallback : public os::CrashProtectionCallback {
143
public:
144
OSThreadSamplerCallback(OSThreadSampler& sampler, const os::SuspendedThreadTaskContext &context) :
145
_sampler(sampler), _context(context) {
146
}
147
virtual void call() {
148
_sampler.protected_task(_context);
149
}
150
private:
151
OSThreadSampler& _sampler;
152
const os::SuspendedThreadTaskContext& _context;
153
};
154
155
void OSThreadSampler::do_task(const os::SuspendedThreadTaskContext& context) {
156
#ifndef ASSERT
157
guarantee(JfrOptionSet::sample_protection(), "Sample Protection should be on in product builds");
158
#endif
159
assert(_suspend_time.value() == 0, "already timestamped!");
160
_suspend_time = JfrTicks::now();
161
162
if (JfrOptionSet::sample_protection()) {
163
OSThreadSamplerCallback cb(*this, context);
164
os::ThreadCrashProtection crash_protection;
165
if (!crash_protection.call(cb)) {
166
log_error(jfr)("Thread method sampler crashed");
167
}
168
} else {
169
protected_task(context);
170
}
171
}
172
173
/*
174
* From this method and down the call tree we attempt to protect against crashes
175
* using a signal handler / __try block. Don't take locks, rely on destructors or
176
* leave memory (in case of signal / exception) in an inconsistent state. */
177
void OSThreadSampler::protected_task(const os::SuspendedThreadTaskContext& context) {
178
JavaThread* jth = context.thread()->as_Java_thread();
179
// Skip sample if we signaled a thread that moved to other state
180
if (!thread_state_in_java(jth)) {
181
return;
182
}
183
JfrGetCallTrace trace(true, jth);
184
frame topframe;
185
if (trace.get_topframe(context.ucontext(), topframe)) {
186
if (_stacktrace.record_thread(*jth, topframe)) {
187
/* If we managed to get a topframe and a stacktrace, create an event
188
* and put it into our array. We can't call Jfr::_stacktraces.add()
189
* here since it would allocate memory using malloc. Doing so while
190
* the stopped thread is inside malloc would deadlock. */
191
_success = true;
192
EventExecutionSample *ev = _closure.next_event();
193
ev->set_starttime(_suspend_time);
194
ev->set_endtime(_suspend_time); // fake to not take an end time
195
ev->set_sampledThread(JFR_THREAD_ID(jth));
196
ev->set_state(static_cast<u8>(java_lang_Thread::get_thread_status(_thread_oop)));
197
}
198
}
199
}
200
201
void OSThreadSampler::take_sample() {
202
run();
203
}
204
205
class JfrNativeSamplerCallback : public os::CrashProtectionCallback {
206
public:
207
JfrNativeSamplerCallback(JfrThreadSampleClosure& closure, JavaThread* jt, JfrStackFrame* frames, u4 max_frames) :
208
_closure(closure), _jt(jt), _thread_oop(jt->threadObj()), _stacktrace(frames, max_frames), _success(false) {
209
}
210
virtual void call();
211
bool success() { return _success; }
212
JfrStackTrace& stacktrace() { return _stacktrace; }
213
214
private:
215
JfrThreadSampleClosure& _closure;
216
JavaThread* _jt;
217
oop _thread_oop;
218
JfrStackTrace _stacktrace;
219
bool _success;
220
};
221
222
static void write_native_event(JfrThreadSampleClosure& closure, JavaThread* jt, oop thread_oop) {
223
EventNativeMethodSample *ev = closure.next_event_native();
224
ev->set_starttime(JfrTicks::now());
225
ev->set_sampledThread(JFR_THREAD_ID(jt));
226
ev->set_state(static_cast<u8>(java_lang_Thread::get_thread_status(thread_oop)));
227
}
228
229
void JfrNativeSamplerCallback::call() {
230
// When a thread is only attach it will be native without a last java frame
231
if (!_jt->has_last_Java_frame()) {
232
return;
233
}
234
235
frame topframe = _jt->last_frame();
236
frame first_java_frame;
237
Method* method = NULL;
238
JfrGetCallTrace gct(false, _jt);
239
if (!gct.find_top_frame(topframe, &method, first_java_frame)) {
240
return;
241
}
242
if (method == NULL) {
243
return;
244
}
245
topframe = first_java_frame;
246
_success = _stacktrace.record_thread(*_jt, topframe);
247
if (_success) {
248
write_native_event(_closure, _jt, _thread_oop);
249
}
250
}
251
252
bool JfrThreadSampleClosure::sample_thread_in_java(JavaThread* thread, JfrStackFrame* frames, u4 max_frames) {
253
OSThreadSampler sampler(thread, *this, frames, max_frames);
254
sampler.take_sample();
255
/* We don't want to allocate any memory using malloc/etc while the thread
256
* is stopped, so everything is stored in stack allocated memory until this
257
* point where the thread has been resumed again, if the sampling was a success
258
* we need to store the stacktrace in the stacktrace repository and update
259
* the event with the id that was returned. */
260
if (!sampler.success()) {
261
return false;
262
}
263
EventExecutionSample *event = &_events[_added_java - 1];
264
traceid id = JfrStackTraceRepository::add(sampler.stacktrace());
265
assert(id != 0, "Stacktrace id should not be 0");
266
event->set_stackTrace(id);
267
return true;
268
}
269
270
bool JfrThreadSampleClosure::sample_thread_in_native(JavaThread* thread, JfrStackFrame* frames, u4 max_frames) {
271
JfrNativeSamplerCallback cb(*this, thread, frames, max_frames);
272
if (JfrOptionSet::sample_protection()) {
273
os::ThreadCrashProtection crash_protection;
274
if (!crash_protection.call(cb)) {
275
log_error(jfr)("Thread method sampler crashed for native");
276
}
277
} else {
278
cb.call();
279
}
280
if (!cb.success()) {
281
return false;
282
}
283
EventNativeMethodSample *event = &_events_native[_added_native - 1];
284
traceid id = JfrStackTraceRepository::add(cb.stacktrace());
285
assert(id != 0, "Stacktrace id should not be 0");
286
event->set_stackTrace(id);
287
return true;
288
}
289
290
static const uint MAX_NR_OF_JAVA_SAMPLES = 5;
291
static const uint MAX_NR_OF_NATIVE_SAMPLES = 1;
292
293
void JfrThreadSampleClosure::commit_events(JfrSampleType type) {
294
if (JAVA_SAMPLE == type) {
295
assert(_added_java > 0 && _added_java <= MAX_NR_OF_JAVA_SAMPLES, "invariant");
296
for (uint i = 0; i < _added_java; ++i) {
297
_events[i].commit();
298
}
299
} else {
300
assert(NATIVE_SAMPLE == type, "invariant");
301
assert(_added_native > 0 && _added_native <= MAX_NR_OF_NATIVE_SAMPLES, "invariant");
302
for (uint i = 0; i < _added_native; ++i) {
303
_events_native[i].commit();
304
}
305
}
306
}
307
308
JfrThreadSampleClosure::JfrThreadSampleClosure(EventExecutionSample* events, EventNativeMethodSample* events_native) :
309
_events(events),
310
_events_native(events_native),
311
_self(Thread::current()),
312
_added_java(0),
313
_added_native(0) {
314
}
315
316
class JfrThreadSampler : public NonJavaThread {
317
friend class JfrThreadSampling;
318
private:
319
Semaphore _sample;
320
Thread* _sampler_thread;
321
JfrStackFrame* const _frames;
322
JavaThread* _last_thread_java;
323
JavaThread* _last_thread_native;
324
size_t _interval_java;
325
size_t _interval_native;
326
int _cur_index;
327
const u4 _max_frames;
328
volatile bool _disenrolled;
329
330
JavaThread* next_thread(ThreadsList* t_list, JavaThread* first_sampled, JavaThread* current);
331
void task_stacktrace(JfrSampleType type, JavaThread** last_thread);
332
JfrThreadSampler(size_t interval_java, size_t interval_native, u4 max_frames);
333
~JfrThreadSampler();
334
335
void start_thread();
336
337
void enroll();
338
void disenroll();
339
void set_java_interval(size_t interval) { _interval_java = interval; };
340
void set_native_interval(size_t interval) { _interval_native = interval; };
341
size_t get_java_interval() { return _interval_java; };
342
size_t get_native_interval() { return _interval_native; };
343
protected:
344
virtual void post_run();
345
public:
346
virtual char* name() const { return (char*)"JFR Thread Sampler"; }
347
bool is_JfrSampler_thread() const { return true; }
348
void run();
349
static Monitor* transition_block() { return JfrThreadSampler_lock; }
350
static void on_javathread_suspend(JavaThread* thread);
351
};
352
353
static void clear_transition_block(JavaThread* jt) {
354
jt->clear_trace_flag();
355
JfrThreadLocal* const tl = jt->jfr_thread_local();
356
if (tl->is_trace_block()) {
357
MutexLocker ml(JfrThreadSampler::transition_block(), Mutex::_no_safepoint_check_flag);
358
JfrThreadSampler::transition_block()->notify_all();
359
}
360
}
361
362
static bool is_excluded(JavaThread* thread) {
363
assert(thread != NULL, "invariant");
364
return thread->is_hidden_from_external_view() || thread->in_deopt_handler() || thread->jfr_thread_local()->is_excluded();
365
}
366
367
bool JfrThreadSampleClosure::do_sample_thread(JavaThread* thread, JfrStackFrame* frames, u4 max_frames, JfrSampleType type) {
368
assert(Threads_lock->owned_by_self(), "Holding the thread table lock.");
369
if (is_excluded(thread)) {
370
return false;
371
}
372
373
bool ret = false;
374
thread->set_trace_flag(); // Provides StoreLoad, needed to keep read of thread state from floating up.
375
if (JAVA_SAMPLE == type) {
376
if (thread_state_in_java(thread)) {
377
ret = sample_thread_in_java(thread, frames, max_frames);
378
}
379
} else {
380
assert(NATIVE_SAMPLE == type, "invariant");
381
if (thread_state_in_native(thread)) {
382
ret = sample_thread_in_native(thread, frames, max_frames);
383
}
384
}
385
clear_transition_block(thread);
386
return ret;
387
}
388
389
JfrThreadSampler::JfrThreadSampler(size_t interval_java, size_t interval_native, u4 max_frames) :
390
_sample(),
391
_sampler_thread(NULL),
392
_frames(JfrCHeapObj::new_array<JfrStackFrame>(max_frames)),
393
_last_thread_java(NULL),
394
_last_thread_native(NULL),
395
_interval_java(interval_java),
396
_interval_native(interval_native),
397
_cur_index(-1),
398
_max_frames(max_frames),
399
_disenrolled(true) {
400
}
401
402
JfrThreadSampler::~JfrThreadSampler() {
403
JfrCHeapObj::free(_frames, sizeof(JfrStackFrame) * _max_frames);
404
}
405
406
void JfrThreadSampler::on_javathread_suspend(JavaThread* thread) {
407
JfrThreadLocal* const tl = thread->jfr_thread_local();
408
tl->set_trace_block();
409
{
410
MonitorLocker ml(transition_block(), Mutex::_no_safepoint_check_flag);
411
while (thread->is_trace_suspend()) {
412
ml.wait();
413
}
414
tl->clear_trace_block();
415
}
416
}
417
418
JavaThread* JfrThreadSampler::next_thread(ThreadsList* t_list, JavaThread* first_sampled, JavaThread* current) {
419
assert(t_list != NULL, "invariant");
420
assert(Threads_lock->owned_by_self(), "Holding the thread table lock.");
421
assert(_cur_index >= -1 && (uint)_cur_index + 1 <= t_list->length(), "invariant");
422
assert((current == NULL && -1 == _cur_index) || (t_list->find_index_of_JavaThread(current) == _cur_index), "invariant");
423
if ((uint)_cur_index + 1 == t_list->length()) {
424
// wrap
425
_cur_index = 0;
426
} else {
427
_cur_index++;
428
}
429
assert(_cur_index >= 0 && (uint)_cur_index < t_list->length(), "invariant");
430
JavaThread* const next = t_list->thread_at(_cur_index);
431
return next != first_sampled ? next : NULL;
432
}
433
434
void JfrThreadSampler::start_thread() {
435
if (os::create_thread(this, os::os_thread)) {
436
os::start_thread(this);
437
} else {
438
log_error(jfr)("Failed to create thread for thread sampling");
439
}
440
}
441
442
void JfrThreadSampler::enroll() {
443
if (_disenrolled) {
444
log_trace(jfr)("Enrolling thread sampler");
445
_sample.signal();
446
_disenrolled = false;
447
}
448
}
449
450
void JfrThreadSampler::disenroll() {
451
if (!_disenrolled) {
452
_sample.wait();
453
_disenrolled = true;
454
log_trace(jfr)("Disenrolling thread sampler");
455
}
456
}
457
458
static jlong get_monotonic_ms() {
459
return os::javaTimeNanos() / 1000000;
460
}
461
462
void JfrThreadSampler::run() {
463
assert(_sampler_thread == NULL, "invariant");
464
465
_sampler_thread = this;
466
467
jlong last_java_ms = get_monotonic_ms();
468
jlong last_native_ms = last_java_ms;
469
while (true) {
470
if (!_sample.trywait()) {
471
// disenrolled
472
_sample.wait();
473
last_java_ms = get_monotonic_ms();
474
last_native_ms = last_java_ms;
475
}
476
_sample.signal();
477
jlong java_interval = _interval_java == 0 ? max_jlong : MAX2<jlong>(_interval_java, 1);
478
jlong native_interval = _interval_native == 0 ? max_jlong : MAX2<jlong>(_interval_native, 1);
479
480
jlong now_ms = get_monotonic_ms();
481
482
/*
483
* Let I be java_interval or native_interval.
484
* Let L be last_java_ms or last_native_ms.
485
* Let N be now_ms.
486
*
487
* Interval, I, might be max_jlong so the addition
488
* could potentially overflow without parenthesis (UB). Also note that
489
* L - N < 0. Avoid UB, by adding parenthesis.
490
*/
491
jlong next_j = java_interval + (last_java_ms - now_ms);
492
jlong next_n = native_interval + (last_native_ms - now_ms);
493
494
jlong sleep_to_next = MIN2<jlong>(next_j, next_n);
495
496
if (sleep_to_next > 0) {
497
os::naked_short_sleep(sleep_to_next);
498
}
499
500
if ((next_j - sleep_to_next) <= 0) {
501
task_stacktrace(JAVA_SAMPLE, &_last_thread_java);
502
last_java_ms = get_monotonic_ms();
503
}
504
if ((next_n - sleep_to_next) <= 0) {
505
task_stacktrace(NATIVE_SAMPLE, &_last_thread_native);
506
last_native_ms = get_monotonic_ms();
507
}
508
}
509
}
510
511
void JfrThreadSampler::post_run() {
512
this->NonJavaThread::post_run();
513
delete this;
514
}
515
516
517
void JfrThreadSampler::task_stacktrace(JfrSampleType type, JavaThread** last_thread) {
518
ResourceMark rm;
519
EventExecutionSample samples[MAX_NR_OF_JAVA_SAMPLES];
520
EventNativeMethodSample samples_native[MAX_NR_OF_NATIVE_SAMPLES];
521
JfrThreadSampleClosure sample_task(samples, samples_native);
522
523
const uint sample_limit = JAVA_SAMPLE == type ? MAX_NR_OF_JAVA_SAMPLES : MAX_NR_OF_NATIVE_SAMPLES;
524
uint num_samples = 0;
525
JavaThread* start = NULL;
526
527
{
528
elapsedTimer sample_time;
529
sample_time.start();
530
{
531
MutexLocker tlock(Threads_lock);
532
ThreadsListHandle tlh;
533
// Resolve a sample session relative start position index into the thread list array.
534
// In cases where the last sampled thread is NULL or not-NULL but stale, find_index() returns -1.
535
_cur_index = tlh.list()->find_index_of_JavaThread(*last_thread);
536
JavaThread* current = _cur_index != -1 ? *last_thread : NULL;
537
538
while (num_samples < sample_limit) {
539
current = next_thread(tlh.list(), start, current);
540
if (current == NULL) {
541
break;
542
}
543
if (start == NULL) {
544
start = current; // remember the thread where we started to attempt sampling
545
}
546
if (current->is_Compiler_thread()) {
547
continue;
548
}
549
if (sample_task.do_sample_thread(current, _frames, _max_frames, type)) {
550
num_samples++;
551
}
552
}
553
*last_thread = current; // remember the thread we last attempted to sample
554
}
555
sample_time.stop();
556
log_trace(jfr)("JFR thread sampling done in %3.7f secs with %d java %d native samples",
557
sample_time.seconds(), sample_task.java_entries(), sample_task.native_entries());
558
}
559
if (num_samples > 0) {
560
sample_task.commit_events(type);
561
}
562
}
563
564
static JfrThreadSampling* _instance = NULL;
565
566
JfrThreadSampling& JfrThreadSampling::instance() {
567
return *_instance;
568
}
569
570
JfrThreadSampling* JfrThreadSampling::create() {
571
assert(_instance == NULL, "invariant");
572
_instance = new JfrThreadSampling();
573
return _instance;
574
}
575
576
void JfrThreadSampling::destroy() {
577
if (_instance != NULL) {
578
delete _instance;
579
_instance = NULL;
580
}
581
}
582
583
JfrThreadSampling::JfrThreadSampling() : _sampler(NULL) {}
584
585
JfrThreadSampling::~JfrThreadSampling() {
586
if (_sampler != NULL) {
587
_sampler->disenroll();
588
}
589
}
590
591
static void log(size_t interval_java, size_t interval_native) {
592
log_trace(jfr)("Updated thread sampler for java: " SIZE_FORMAT " ms, native " SIZE_FORMAT " ms", interval_java, interval_native);
593
}
594
595
void JfrThreadSampling::start_sampler(size_t interval_java, size_t interval_native) {
596
assert(_sampler == NULL, "invariant");
597
log_trace(jfr)("Enrolling thread sampler");
598
_sampler = new JfrThreadSampler(interval_java, interval_native, JfrOptionSet::stackdepth());
599
_sampler->start_thread();
600
_sampler->enroll();
601
}
602
603
void JfrThreadSampling::set_sampling_interval(bool java_interval, size_t period) {
604
size_t interval_java = 0;
605
size_t interval_native = 0;
606
if (_sampler != NULL) {
607
interval_java = _sampler->get_java_interval();
608
interval_native = _sampler->get_native_interval();
609
}
610
if (java_interval) {
611
interval_java = period;
612
} else {
613
interval_native = period;
614
}
615
if (interval_java > 0 || interval_native > 0) {
616
if (_sampler == NULL) {
617
log_trace(jfr)("Creating thread sampler for java:%zu ms, native %zu ms", interval_java, interval_native);
618
start_sampler(interval_java, interval_native);
619
} else {
620
_sampler->set_java_interval(interval_java);
621
_sampler->set_native_interval(interval_native);
622
_sampler->enroll();
623
}
624
assert(_sampler != NULL, "invariant");
625
log(interval_java, interval_native);
626
} else if (_sampler != NULL) {
627
_sampler->disenroll();
628
}
629
}
630
631
void JfrThreadSampling::set_java_sample_interval(size_t period) {
632
if (_instance == NULL && 0 == period) {
633
return;
634
}
635
instance().set_sampling_interval(true, period);
636
}
637
638
void JfrThreadSampling::set_native_sample_interval(size_t period) {
639
if (_instance == NULL && 0 == period) {
640
return;
641
}
642
instance().set_sampling_interval(false, period);
643
}
644
645
void JfrThreadSampling::on_javathread_suspend(JavaThread* thread) {
646
JfrThreadSampler::on_javathread_suspend(thread);
647
}
648
649