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

Method checkpoint

src/j9StackTraces.cpp:152–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150}
151
152void J9StackTraces::checkpoint(u64 counter, J9StackTraceNotification* notif) {
153 JNIEnv* self_env = loadAcquire(_self_env);
154 if (self_env == nullptr) {
155 // Sampler thread is not ready
156 return;
157 }
158
159 JNIEnv* env = VM::jni();
160 if (env != NULL && env != self_env) {
161 J9VMThread* vm_thread = (J9VMThread*)env;
162 uintptr_t flags = vm_thread->getAndSetFlag(J9_HALT_THREAD_INSPECTION);
163 if (flags & J9_HALT_THREAD_INSPECTION) {
164 // Thread is already scheduled for inspection, no need to notify again
165 return;
166 } else if (!(flags & J9_STOPPED)) {
167 vm_thread->setOverflowMark();
168 notif->env = env;
169 notif->counter = counter;
170 if (write(_pipe[1], notif, notif->size()) > 0) {
171 return;
172 }
173 }
174 // Something went wrong - rollback
175 vm_thread->clearFlag(J9_HALT_THREAD_INSPECTION);
176 }
177}

Callers

nothing calls this directly

Calls 5

loadAcquireFunction · 0.85
getAndSetFlagMethod · 0.80
setOverflowMarkMethod · 0.80
clearFlagMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected