GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — async-profiler/src/cpuEngine.cpp at jonoffcpu-dev · jonoffcpu/async-profiler Expand file tree/ Copy pathcpuEngine.cppMore file actions 83 lines (67 loc) · 2.17 KB / Copy pathcpuEngine.cppFile metadata and controls83 lines (67 loc) · 2.17 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 /* * Copyright The async-profiler authors * SPDX-License-Identifier: Apache-2.0 */ #include <errno.h> #include "cpuEngine.h" #include "j9StackTraces.h" #include "profiler.h" #include "stackWalker.h" #include "tsc.h" CpuEngine* CpuEngine::_current = nullptr; long CpuEngine::_interval; CStack CpuEngine::_cstack; int CpuEngine::_signal; bool CpuEngine::_count_overrun; void CpuEngine::onThreadStart() { CpuEngine* current = loadAcquire(_current); if (current != nullptr) { current->createForThread(OS::threadId()); } } void CpuEngine::onThreadEnd() { CpuEngine* current = loadAcquire(_current); if (current != nullptr) { current->destroyForThread(OS::threadId()); } } void CpuEngine::enableThreadEvents() { storeRelease(_current, this); } void CpuEngine::disableThreadEvents() { storeRelease(_current, nullptr); } bool CpuEngine::isResourceLimit(int err) { return err == EMFILE || err == ENOMEM; } int CpuEngine::createForAllThreads() { int result = EPERM; ThreadList* thread_list = OS::listThreads(); while (thread_list->hasNext()) { int tid = thread_list->next(); int err = createForThread(tid); if (isResourceLimit(err)) { result = err; break; } else if (result != 0) { result = err; } } delete thread_list; return result; } void CpuEngine::signalHandler(int signo, siginfo_t* siginfo, void* ucontext) { if (!_enabled) return; ExecutionEvent event(TSC::ticks()); // Count missed samples when estimating total CPU time u64 total_cpu_time = _count_overrun ? u64(_interval) * (1 + OS::overrun(siginfo)) : u64(_interval); Profiler::instance()->recordSample(ucontext, total_cpu_time, EXECUTION_SAMPLE, &event); } void CpuEngine::signalHandlerJ9(int signo, siginfo_t* siginfo, void* ucontext) { if (!_enabled) return; J9StackTraceNotification notif; notif.num_frames = _cstack == CSTACK_NO ? 0 : _cstack == CSTACK_DWARF ? StackWalker::walkDwarf(ucontext, notif.addr, MAX_J9_NATIVE_FRAMES) : StackWalker::walkFP(ucontext, notif.addr, MAX_J9_NATIVE_FRAMES); J9StackTraces::checkpoint(_interval, ¬if); } |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |