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

Method LateInitializer

src/zInit.cpp:17–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15class LateInitializer {
16 public:
17 LateInitializer() {
18 Dl_info dl_info;
19 if (!OS::isMusl() && dladdr((const void*)Hooks::init, &dl_info) && dl_info.dli_fname != NULL) {
20 // Make sure async-profiler DSO cannot be unloaded, since it contains JVM callbacks.
21 // This is not relevant for musl, where dlclose() is no-op.
22 // Can't use ELF NODELETE flag because of https://sourceware.org/bugzilla/show_bug.cgi?id=20839
23 dlopen(dl_info.dli_fname, RTLD_LAZY | RTLD_NODELETE);
24 }
25
26 if (!checkJvmLoaded()) {
27 const char* command = getenv("ASPROF_COMMAND");
28 if (command != NULL && OS::checkPreloaded() && Hooks::init(false)) {
29 startProfiler(command);
30 }
31 }
32 }
33
34 private:
35 bool checkJvmLoaded() {

Callers

nothing calls this directly

Calls 2

dlopenFunction · 0.85
startProfilerFunction · 0.85

Tested by

no test coverage detected