// Detaches the xdebug profiler if it's no longer needed static void detach_xdebug_profiler_if_needed() { assert(XDEBUG_GLOBAL(ProfilerAttached)); auto profiler = xdebug_profiler(); if (!profiler->isNeeded()) { detach_xdebug_profiler(); } }
void XDebugProfiler::beginFrame(const char *symbol) { assert(isNeeded()); // Check the stack depth, abort if we've reached the limit m_depth++; if (m_maxDepth != 0 && m_depth >= m_maxDepth) { raise_error("Maximum function nesting level of '%lu' reached, aborting!", m_maxDepth); } // Record the frame if we are collecting if (isCollecting()) { recordFrame(nullptr); } }
void XDebugProfiler::endFrame(const TypedValue* retVal, const char* /*symbol*/, bool /*endMain*/ /* = false */) { assert(isNeeded()); m_depth--; if (isCollecting()) { // If tracing or profiling are enabled, we need to store end frames as well. // Otherwise we can just overwrite the most recent begin frame if (m_tracingEnabled || m_profilingEnabled) { recordFrame(retVal); } else { m_nextFrameIdx--; } } }