diff --git a/.github/workflows/dd-sync.yml b/.github/workflows/dd-sync.yml new file mode 100644 index 0000000000000..c94e4f63a0184 --- /dev/null +++ b/.github/workflows/dd-sync.yml @@ -0,0 +1,38 @@ +# .github/workflows/sync-upstream.yml +name: Sync Upstream + +on: + schedule: + - cron: '22 14 * * *' # Runs every day at 14:15 UTC + workflow_dispatch: + +permissions: + contents: write + actions: read + +jobs: + sync: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + + - name: Pull latest changes from upstream + run: | + git config --global user.email "sync@datadoghq.com" + git config --global user.name "Datadog Syncup Service" + git remote add upstream https://github.com/openjdk/jdk.git + git fetch upstream + git checkout -b upstream-master upstream/master + git checkout master + git merge upstream-master + + - name: Push changes to downstream + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GH_PAT }} + branch: master diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000..2374fa4481d59 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,43 @@ +image: alpine + +stages: [prepare, trigger] + +prepare: + stage: prepare + image: "486234852809.dkr.ecr.us-east-1.amazonaws.com/images/docker:24.0.4-gbi-focal" + tags: [ "arch:arm64" ] + script: + - echo "Preparing to trigger the build pipeline" + - echo "FEATURE_VERSION=$(cat make/conf/version-numbers.conf | grep 'DEFAULT_VERSION_FEATURE=' | cut -d '=' -f 2)" > build.env + artifacts: + reports: + dotenv: build.env + expire_in: 1 day + +build: + stage: trigger + needs: [prepare] + variables: + JDK_VERSION: "latest" + DEBUG_LEVEL: "fastdebug" + HASH: "${CI_COMMIT_SHORT_SHA}" + trigger: + project: DataDog/openjdk-build + strategy: depend + branch: main + forward: + pipeline_variables: true + +test: + stage: trigger + needs: [prepare, build] + variables: + JDK_VERSION: "${FEATURE_VERSION}" + DEBUG_LEVEL: "fastdebug" + HASH: "${CI_COMMIT_SHORT_SHA}" + trigger: + project: DataDog/apm-reliability/async-profiler-build + strategy: depend + branch: main + forward: + pipeline_variables: true \ No newline at end of file diff --git a/src/hotspot/os/posix/dtrace/hotspot_jvmti.d b/src/hotspot/os/posix/dtrace/hotspot_jvmti.d new file mode 100644 index 0000000000000..d2c15fee59b67 --- /dev/null +++ b/src/hotspot/os/posix/dtrace/hotspot_jvmti.d @@ -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 diff --git a/src/hotspot/share/runtime/threadHeapSampler.cpp b/src/hotspot/share/runtime/threadHeapSampler.cpp index 04f3f8b220a30..1c39dd6138be7 100644 --- a/src/hotspot/share/runtime/threadHeapSampler.cpp +++ b/src/hotspot/share/runtime/threadHeapSampler.cpp @@ -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. @@ -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; diff --git a/src/hotspot/share/utilities/dtrace.hpp b/src/hotspot/share/utilities/dtrace.hpp index d6fa51efbeaa1..47bf302dfdefc 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_jvmti.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 6cbd79326ac1f..3c6dd1abbb843 100644 --- a/src/hotspot/share/utilities/dtrace_disabled.hpp +++ b/src/hotspot/share/utilities/dtrace_disabled.hpp @@ -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