Skip to content

WIP #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/hotspot/os/posix/dtrace/hotspot_jvmti.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
provider hotspot_jvmti {
probe AllocObject__sample(char*, size_t, size_t);
};

#pragma D attributes Standard/Standard/Common provider hotspot_jvmti provider
#pragma D attributes Private/Private/Unknown provider hotspot_jvmti module
#pragma D attributes Private/Private/Unknown provider hotspot_jvmti function
#pragma D attributes Standard/Standard/Common provider hotspot_jvmti name
#pragma D attributes Evolving/Evolving/Common provider hotspot_jvmti args
5 changes: 5 additions & 0 deletions src/hotspot/share/runtime/threadHeapSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
#include "runtime/threadHeapSampler.hpp"
#include "utilities/checkedCast.hpp"

#include "oops/oop.inline.hpp"
#include "utilities/dtrace.hpp"

// Cheap random number generator.
uint64_t ThreadHeapSampler::_rnd;
// Default is 512kb.
Expand Down Expand Up @@ -424,6 +427,8 @@ void ThreadHeapSampler::check_for_sampling(oop obj, size_t allocation_size, size
return;
}

HOTSPOT_JVMTI_ALLOCOBJECT_SAMPLE(obj->klass()->name()->as_C_string(), allocation_size, bytes_since_allocation);

JvmtiExport::sampled_object_alloc_event_collector(obj);

size_t overflow_bytes = total_allocated_bytes - _bytes_until_sample;
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/utilities/dtrace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@

#include "dtracefiles/hotspot.h"
#include "dtracefiles/hotspot_jni.h"
#include "dtracefiles/hotspot_jvmti.h"
#include "dtracefiles/hs_private.h"

#else /* defined(DTRACE_ENABLED) */
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/utilities/dtrace_disabled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,9 @@
#define HOTSPOT_JNI_UNREGISTERNATIVES_RETURN(arg0)
#define HOTSPOT_JNI_UNREGISTERNATIVES_RETURN_ENABLED() 0

/* JVMTI */
#define HOTSPOT_JVMTI_ALLOCOBJECT_SAMPLE(arg0, arg1, arg2)

/* Modules */
#define HOTSPOT_JNI_GETMODULE_ENTRY(arg0, arg1)
#define HOTSPOT_JNI_GETMODULE_ENTRY_ENABLED() 0
Expand Down
Loading