Exemplo n.º 1
0
// 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();
  }
}
Exemplo n.º 2
0
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);
  }
}
Exemplo n.º 3
0
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--;
    }
  }
}