diff --git a/.github/workflows/dd-sync.yml b/.github/workflows/dd-sync.yml index e30ce9b2118c1..c94e4f63a0184 100644 --- a/.github/workflows/dd-sync.yml +++ b/.github/workflows/dd-sync.yml @@ -6,6 +6,10 @@ on: - cron: '22 14 * * *' # Runs every day at 14:15 UTC workflow_dispatch: +permissions: + contents: write + actions: read + jobs: sync: runs-on: ubuntu-latest diff --git a/src/hotspot/os/posix/dtrace/hotspot_gc.d b/src/hotspot/os/posix/dtrace/hotspot_gc.d new file mode 100644 index 0000000000000..288b6306fdc1e --- /dev/null +++ b/src/hotspot/os/posix/dtrace/hotspot_gc.d @@ -0,0 +1,9 @@ +provider hotspot_gc { + probe AllocObject__sample(char*, size_t, size_t); +}; + +#pragma D attributes Standard/Standard/Common provider hotspot_gc provider +#pragma D attributes Private/Private/Unknown provider hotspot_gc module +#pragma D attributes Private/Private/Unknown provider hotspot_gc function +#pragma D attributes Standard/Standard/Common provider hotspot_gc name +#pragma D attributes Evolving/Evolving/Common provider hotspot_gc args diff --git a/src/hotspot/share/runtime/threadHeapSampler.cpp b/src/hotspot/share/runtime/threadHeapSampler.cpp index 4bdfedb31b0c8..26a0aa3793bac 100644 --- a/src/hotspot/share/runtime/threadHeapSampler.cpp +++ b/src/hotspot/share/runtime/threadHeapSampler.cpp @@ -33,6 +33,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. @@ -425,6 +428,8 @@ void ThreadHeapSampler::check_for_sampling(oop obj, size_t allocation_size, size return; } + HOTSPOT_GC_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; diff --git a/src/hotspot/share/utilities/dtrace.hpp b/src/hotspot/share/utilities/dtrace.hpp index d6fa51efbeaa1..f10f738f6b433 100644 --- a/src/hotspot/share/utilities/dtrace.hpp +++ b/src/hotspot/share/utilities/dtrace.hpp @@ -36,6 +36,7 @@ #include "dtracefiles/hotspot.h" #include "dtracefiles/hotspot_jni.h" +#include "dtracefiles/hotspot_gc.h" #include "dtracefiles/hs_private.h" #else /* defined(DTRACE_ENABLED) */ diff --git a/src/hotspot/share/utilities/dtrace_disabled.hpp b/src/hotspot/share/utilities/dtrace_disabled.hpp index b6ffb5936ea85..69b254a7bb76b 100644 --- a/src/hotspot/share/utilities/dtrace_disabled.hpp +++ b/src/hotspot/share/utilities/dtrace_disabled.hpp @@ -1082,6 +1082,8 @@ #define HOTSPOT_JNI_GETMODULE_RETURN(arg0) #define HOTSPOT_JNI_GETMODULE_RETURN_ENABLED() +#define HOTSPOT_GC_ALLOCOBJECT_SAMPLE(arg0, arg1, arg2) + #else /* !defined(DTRACE_ENABLED) */ #error This file should only be included when dtrace is not enabled #endif /* !defined(DTRACE_ENABLED) */