/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
staticvoid DiscardSuspendedThreadRunningTimes(
PSLockRef aLock,
ThreadRegistration::UnlockedRWForLockedProfiler& aThreadData) { // Nothing to do! // On macOS, suspending a thread doesn't make that thread work.
}
//----------------------------------------------------------------// // Suspend the samplee thread and get its context.
// We're using thread_suspend on OS X because pthread_kill (which is what we // at one time used on Linux) has less consistent performance and causes // strange crashes, see bug 1166778 and bug 1166808. thread_suspend // is also just a lot simpler to use.
if (KERN_SUCCESS != thread_suspend(samplee_thread)) { return;
}
//----------------------------------------------------------------// // Sample the target thread.
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING // // The profiler's "critical section" begins here. We must be very careful // what we do here, or risk deadlock. See the corresponding comment in // platform-linux-android.cpp for details.
SamplerThread::~SamplerThread() { if (pthread_equal(mThread, pthread_self())) {
pthread_detach(mThread);
} else {
pthread_join(mThread, nullptr);
} // Just in the unlikely case some callbacks were added between the end of the // thread and now.
InvokePostSamplingCallbacks(std::move(mPostSamplingCallbackList),
SamplingState::JustStopped);
}
void SamplerThread::SleepMicro(uint32_t aMicroseconds) {
usleep(aMicroseconds); // FIXME: the OSX 10.12 page for usleep says "The usleep() function is // obsolescent. Use nanosleep(2) instead." This implementation could be // merged with the linux-android version. Also, this doesn't handle the // case where the usleep call is interrupted by a signal.
}
// END SamplerThread target specifics ////////////////////////////////////////////////////////////////////////
staticvoid PlatformInit(PSLockRef aLock) {}
// clang-format off #ifdefined(HAVE_NATIVE_UNWIND) // Derive the stack pointer from the frame pointer. The 0x10 offset is // 8 bytes for the previous frame pointer and 8 bytes for the return // address both stored on the stack after at the beginning of the current // frame. # define REGISTERS_SYNC_POPULATE(regs) \
regs.mSP = reinterpret_cast<Address>(__builtin_frame_address(0)) + 0x10; \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wframe-address\"") \
regs.mFP = reinterpret_cast<Address>(__builtin_frame_address(1)); \
_Pragma("GCC diagnostic pop") \
regs.mPC = reinterpret_cast<Address>( \
__builtin_extract_return_addr(__builtin_return_address(0))); #endif // clang-format on
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.