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

Method init

src/hooks.cpp:156–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

154bool Hooks::_initialized = false;
155
156bool Hooks::init(bool attach) {
157 if (!__sync_bool_compare_and_swap(&_initialized, false, true)) {
158 return false;
159 }
160
161 Profiler::setupSignalHandlers();
162
163 if (attach) {
164 Profiler::instance()->updateSymbols(false);
165 _orig_pthread_create = ADDRESS_OF(pthread_create);
166 _orig_pthread_exit = ADDRESS_OF(pthread_exit);
167 _orig_dlopen = ADDRESS_OF(dlopen);
168 patchLibraries();
169 }
170
171 atexit(shutdown);
172
173 return true;
174}
175
176void Hooks::shutdown() {
177 Profiler::instance()->shutdown(_global_args);

Callers 1

startMethod · 0.45

Calls 1

updateSymbolsMethod · 0.80

Tested by

no test coverage detected