mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8201655: Add thread-enabled support for the Heap Sampling
Added thread-enabled support Reviewed-by: amenkov, sspitsyn
This commit is contained in:
parent
d1951aa97c
commit
f3657753d6
5 changed files with 100 additions and 123 deletions
|
@ -2567,6 +2567,11 @@ void JvmtiExport::post_vm_object_alloc(JavaThread *thread, oop object) {
|
|||
}
|
||||
|
||||
void JvmtiExport::post_sampled_object_alloc(JavaThread *thread, oop object) {
|
||||
JvmtiThreadState *state = thread->jvmti_thread_state();
|
||||
if (state == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
EVT_TRIG_TRACE(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC,
|
||||
("[%s] Trg sampled object alloc triggered",
|
||||
JvmtiTrace::safe_get_thread_name(thread)));
|
||||
|
@ -2575,14 +2580,16 @@ void JvmtiExport::post_sampled_object_alloc(JavaThread *thread, oop object) {
|
|||
}
|
||||
HandleMark hm(thread);
|
||||
Handle h(thread, object);
|
||||
JvmtiEnvIterator it;
|
||||
for (JvmtiEnv* env = it.first(); env != NULL; env = it.next(env)) {
|
||||
if (env->is_enabled(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC)) {
|
||||
|
||||
JvmtiEnvThreadStateIterator it(state);
|
||||
for (JvmtiEnvThreadState* ets = it.first(); ets != NULL; ets = it.next(ets)) {
|
||||
if (ets->is_enabled(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC)) {
|
||||
EVT_TRACE(JVMTI_EVENT_SAMPLED_OBJECT_ALLOC,
|
||||
("[%s] Evt sampled object alloc sent %s",
|
||||
JvmtiTrace::safe_get_thread_name(thread),
|
||||
object == NULL ? "NULL" : object->klass()->external_name()));
|
||||
|
||||
JvmtiEnv *env = ets->get_env();
|
||||
JvmtiObjectAllocEventMark jem(thread, h());
|
||||
JvmtiJavaThreadEventTransition jet(thread);
|
||||
jvmtiEventSampledObjectAlloc callback = env->callbacks()->SampledObjectAlloc;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue