Skip to content
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

WIP #5

Draft
wants to merge 2 commits 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
4 changes: 4 additions & 0 deletions .github/workflows/dd-sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions src/hotspot/os/posix/dtrace/hotspot_gc.d
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions src/hotspot/share/runtime/threadHeapSampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
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_gc.h"
#include "dtracefiles/hs_private.h"

#else /* defined(DTRACE_ENABLED) */
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/utilities/dtrace_disabled.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) */
Expand Down
Loading