Skip to content

Commit c306677

Browse files
committed
WIP
1 parent 6006208 commit c306677

File tree

4 files changed

+17
-0
lines changed

4 files changed

+17
-0
lines changed
+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
provider hotspot_gc {
2+
probe AllocObject__sample(char*, size_t, size_t);
3+
}
4+
5+
#pragma D attributes Standard/Standard/Common provider hotspot_gc provider
6+
#pragma D attributes Private/Private/Unknown provider hotspot_gc module
7+
#pragma D attributes Private/Private/Unknown provider hotspot_gc function
8+
#pragma D attributes Standard/Standard/Common provider hotspot_gc name
9+
#pragma D attributes Evolving/Evolving/Common provider hotspot_gc args

src/hotspot/share/runtime/threadHeapSampler.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
#include "runtime/threadHeapSampler.hpp"
3434
#include "utilities/checkedCast.hpp"
3535

36+
#include "oops/oop.inline.hpp"
37+
#include "utilities/dtrace.hpp"
38+
3639
// Cheap random number generator.
3740
uint64_t ThreadHeapSampler::_rnd;
3841
// Default is 512kb.
@@ -425,6 +428,8 @@ void ThreadHeapSampler::check_for_sampling(oop obj, size_t allocation_size, size
425428
return;
426429
}
427430

431+
HOTSPOT_GC_ALLOCOBJECT_SAMPLE(obj->klass()->name()->as_C_string(), allocation_size, bytes_since_allocation);
432+
428433
JvmtiExport::sampled_object_alloc_event_collector(obj);
429434

430435
size_t overflow_bytes = total_allocated_bytes - _bytes_until_sample;

src/hotspot/share/utilities/dtrace.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "dtracefiles/hotspot.h"
3838
#include "dtracefiles/hotspot_jni.h"
39+
#include "dtracefiles/hotspot_gc.h"
3940
#include "dtracefiles/hs_private.h"
4041

4142
#else /* defined(DTRACE_ENABLED) */

src/hotspot/share/utilities/dtrace_disabled.hpp

+2
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,8 @@
10821082
#define HOTSPOT_JNI_GETMODULE_RETURN(arg0)
10831083
#define HOTSPOT_JNI_GETMODULE_RETURN_ENABLED()
10841084

1085+
#define HOTSPOT_GC_ALLOCOBJECT_SAMPLE(arg0, arg1, arg2)
1086+
10851087
#else /* !defined(DTRACE_ENABLED) */
10861088
#error This file should only be included when dtrace is not enabled
10871089
#endif /* !defined(DTRACE_ENABLED) */

0 commit comments

Comments
 (0)