MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / initialize

Method initialize

src/allocTracer.cpp:21–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19
20
21Error AllocTracer::initialize() {
22 if (_in_new_tlab.entry() == 0 || _outside_tlab.entry() == 0) {
23 CodeCache* libjvm = VMStructs::libjvm();
24 const void* ne;
25 const void* oe;
26
27 if ((ne = libjvm->findSymbolByPrefix("_ZN11AllocTracer27send_allocation_in_new_tlab")) != NULL &&
28 (oe = libjvm->findSymbolByPrefix("_ZN11AllocTracer28send_allocation_outside_tlab")) != NULL) {
29 _trap_kind = 1; // JDK 10+
30 } else if ((ne = libjvm->findSymbolByPrefix("_ZN11AllocTracer33send_allocation_in_new_tlab_eventE11KlassHandleP8HeapWord")) != NULL &&
31 (oe = libjvm->findSymbolByPrefix("_ZN11AllocTracer34send_allocation_outside_tlab_eventE11KlassHandleP8HeapWord")) != NULL) {
32 _trap_kind = 1; // JDK 8u262+
33 } else if ((ne = libjvm->findSymbolByPrefix("_ZN11AllocTracer33send_allocation_in_new_tlab_event")) != NULL &&
34 (oe = libjvm->findSymbolByPrefix("_ZN11AllocTracer34send_allocation_outside_tlab_event")) != NULL) {
35 _trap_kind = 2; // JDK 7-9
36 } else {
37 return Error("No AllocTracer symbols found. Are JDK debug symbols installed?");
38 }
39
40 _in_new_tlab.assign(ne);
41 _outside_tlab.assign(oe);
42 _in_new_tlab.pair(_outside_tlab);
43 }
44
45 return Error::OK;
46}
47
48// Called whenever our breakpoint trap is hit
49void AllocTracer::trapHandler(int signo, siginfo_t* siginfo, void* ucontext) {

Callers

nothing calls this directly

Calls 5

ErrorClass · 0.85
findSymbolByPrefixMethod · 0.80
assignMethod · 0.80
pairMethod · 0.80
entryMethod · 0.45

Tested by

no test coverage detected